=r}),this.layoutUp(n),this.layoutDown(i));break;case"right":this.layoutRight(this.center.children);break;case"left":this.layoutLeft(this.center.children);break;case"up":case"bottom":this.layoutUp(this.center.children);break;case"down":case"top":this.layoutDown(this.center.children);break;case"tipover":case"tipovertree":if(0>this.options.tipOverTreeStartLevel)throw"The tip-over level should be a positive integer.";this.tipOverTree(this.center.children,this.options.tipOverTreeStartLevel);break;case"undefined":case"none":}}}),x=b.extend({init:function(e){var t=this;if(b.fn.init.call(t),f.isUndefined(e))throw"No diagram specified.";this.diagram=e},layout:function(e){var t,n;return this.transferOptions(e),t=new w(this.diagram),this.graph=t.convert(),n=this.layoutComponents(),new i.LayoutState(this.diagram,n)},layoutComponents:function(){var e,t,n,i,r,o,a,s;if(!this.graph.isEmpty()&&(e=this.graph.getConnectedComponents(),!f.isEmpty(e))){for(t=new k(this.options),n=[],i=0;e.length>i;i++){if(r=e[i],o=this.getTree(r),!o)throw"Failed to find a spanning tree for the component.";a=o.root,s=o.tree,t.layout(s,a),n.push(s)}return this.gridLayoutComponents(n)}},getTree:function(e){var t,n,i,r,o,a=null;if(this.options.roots&&this.options.roots.length>0)for(t=0,n=e.nodes.length;n>t;t++)for(i=e.nodes[t],r=0;this.options.roots.length>r;r++)if(o=this.options.roots[r],o===i.associatedShape){a=i;break}if(!a&&(a=e.root(),!a))throw"Unable to find a root for the tree.";return this.getTreeForRoot(e,a)},getTreeForRoot:function(e,t){var n=e.getSpanningTree(t);return f.isUndefined(n)||n.isEmpty()?null:{tree:n,root:n.root}}}),C=b.extend({init:function(e){var t=this;if(b.fn.init.call(t),f.isUndefined(e))throw"Diagram is not specified.";this.diagram=e},layout:function(e){var t,n,r,o,a,s;if(this.transferOptions(e),t=new w(this.diagram),n=t.convert(e),!n.isEmpty()&&(r=n.getConnectedComponents(),!f.isEmpty(r))){for(o=0;r.length>o;o++)a=r[o],this.layoutGraph(a,e);return s=this.gridLayoutComponents(r),new i.LayoutState(this.diagram,s)}},_initRuntimeProperties:function(){var e,t;for(e=0;this.graph.nodes.length>e;e++)t=this.graph.nodes[e],t.layer=-1,t.downstreamLinkCount=0,t.upstreamLinkCount=0,t.isVirtual=!1,t.uBaryCenter=0,t.dBaryCenter=0,t.upstreamPriority=0,t.downstreamPriority=0,t.gridPosition=0},_prepare:function(e){var t,n,i,r,o,a,s,l,c,u,h,p=[],m=new d,g=0;for(f.forEach(e.nodes,function(e){0===e.incoming.length&&(m.set(e,0),p.push(e))});p.length>0;)for(o=p.shift(),t=0;o.outgoing.length>t;t++)i=o.outgoing[t],a=i.target,r=m.containsKey(a)?Math.max(m.get(o)+1,m.get(a)):m.get(o)+1,m.set(a,r),r>g&&(g=r),v(p,a)||p.push(a);for(s=m.keys(),s.sort(function(e,t){var n=m.get(e),i=m.get(t);return f.sign(i-n)}),l=0;s.length>l;++l)if(c=s[l],u=Number.MAX_VALUE,0!==c.outgoing.length){for(n=0;c.outgoing.length>n;++n)i=c.outgoing[n],u=Math.min(u,m.get(i.target));u>1&&m.set(c,u-1)}for(this.layers=[],t=0;g+1>t;t++)h=[],h.linksTo={},this.layers.push(h);for(m.forEach(function(e,t){e.layer=t,this.layers[t].push(e)},this),n=0;this.layers.length>n;n++)for(h=this.layers[n],t=0;h.length>t;t++)h[t].gridPosition=t},layoutGraph:function(e,t){if(f.isUndefined(e))throw"No graph given or graph analysis of the diagram failed.";f.isDefined(t)&&this.transferOptions(t),this.graph=e,e.setItemIndices();var n=e.makeAcyclic();this._initRuntimeProperties(),this._prepare(e,t),this._dummify(),this._optimizeCrossings(),this._swapPairs(),this.arrangeNodes(),this._moveThingsAround(),this._dedummify(),f.forEach(n,function(e){e.points&&e.points.reverse()})},setMinDist:function(e,t,n){var i=e.layer,r=e.layerIndex;this.minDistances[i][r]=n},getMinDist:function(e,t){var n,i=0,r=e.layerIndex,o=t.layerIndex,a=e.layer,s=Math.min(r,o),l=Math.max(r,o);for(n=s;l>n;++n)i+=this.minDistances[a][n];return i},placeLeftToRight:function(e){var t,n,i,r,o,a,s,l,c,u,h=new d;for(i=0;this.layers.length>i;++i)if(r=e[i]){for(t=0;r.length>t;t++)n=r[t],h.containsKey(n)||this.placeLeft(n,h,i);for(o=Number.POSITIVE_INFINITY,t=0;r.length>t;t++)n=r[t],a=this.rightSibling(n),a&&this.nodeLeftClass.get(a)!==i&&(o=Math.min(o,h.get(a)-h.get(n)-this.getMinDist(n,a)));if(o===Number.POSITIVE_INFINITY){for(s=[],t=0;r.length>t;t++)for(n=r[t],l=[],f.addRange(l,this.upNodes.get(n)),f.addRange(l,this.downNodes.get(n)),c=0;l.length>c;c++)u=l[c],this.nodeLeftClass.get(u)t;t++)n=r[t],h.set(n,h.get(n)+o)}return h},placeRightToLeft:function(e){var t,n,i,r,o,a,s,l,c,u,h=new d;for(i=0;this.layers.length>i;++i)if(r=e[i]){for(t=0;r.length>t;t++)n=r[t],h.containsKey(n)||this.placeRight(n,h,i);for(o=Number.NEGATIVE_INFINITY,t=0;r.length>t;t++)n=r[t],a=this.leftSibling(n),a&&this.nodeRightClass.get(a)!==i&&(o=Math.max(o,h.get(a)-h.get(n)+this.getMinDist(a,n)));if(o===Number.NEGATIVE_INFINITY){for(s=[],t=0;r.length>t;t++)for(n=r[t],l=[],f.addRange(l,this.upNodes.get(n)),f.addRange(l,this.downNodes.get(n)),c=0;l.length>c;c++)u=l[c],this.nodeRightClass.get(u)t;t++)n=r[t],h.set(n,h.get(n)+o)}return h},_getLeftWing:function(){var e={value:null},t=this.computeClasses(e,1);return this.nodeLeftClass=e.value,t},_getRightWing:function(){var e={value:null},t=this.computeClasses(e,-1);return this.nodeRightClass=e.value,t},computeClasses:function(e,t){var n,i,r,o,a,s,l,c,u,h=0,f=e.value=new d;for(n=0;this.layers.length>n;++n)for(h=n,i=this.layers[n],r=1===t?0:i.length-1;r>=0&&i.length>r;r+=t)if(o=i[r],f.containsKey(o))h=f.get(o);else if(f.set(o,h),o.isVirtual)for(a=this._nodesInLink(o),s=0;a.length>s;s++)l=a[s],f.set(l,h);for(c=[],u=0;this.layers.length>u;u++)c.push(null);return f.forEach(function(e,t){null===c[t]&&(c[t]=[]),c[t].push(e)}),c},_isVerticalLayout:function(){return"up"===this.options.subtype.toLowerCase()||"down"===this.options.subtype.toLowerCase()||"vertical"===this.options.subtype.toLowerCase()},_isHorizontalLayout:function(){return"right"===this.options.subtype.toLowerCase()||"left"===this.options.subtype.toLowerCase()||"horizontal"===this.options.subtype.toLowerCase()},_isIncreasingLayout:function(){return"right"===this.options.subtype.toLowerCase()||"down"===this.options.subtype.toLowerCase()},_moveThingsAround:function(){function e(e,t){var n,i,r=Number.MIN_VALUE;for(n=0;e.length>n;++n)i=e[n],r=t._isVerticalLayout()?Math.max(r,i.height):Math.max(r,i.width);return r}var t,n,i,r,o,a,s,l,c,u,h,p,m,g,v,_,b,w,y,k,x,C,S,T,D,A,E;for(n=0;this.layers.length>n;++n)r=this.layers[n],r.sort(this._gridPositionComparer);for(this.minDistances=[],n=0;this.layers.length>n;++n)for(r=this.layers[n],this.minDistances[n]=[],o=0;r.length>o;++o)i=r[o],i.layerIndex=o,this.minDistances[n][o]=this.options.nodeDistance,r.length-1>o&&(this.minDistances[n][o]+=this._isVerticalLayout()?(i.width+r[o+1].width)/2:(i.height+r[o+1].height)/2);for(this.downNodes=new d,this.upNodes=new d,f.forEach(this.graph.nodes,function(e){this.downNodes.set(e,[]),this.upNodes.set(e,[])},this),f.forEach(this.graph.links,function(e){var t=e.source,n=e.target,i=null,r=null;t.layer>n.layer?(i=e.source,r=e.target):(r=e.source,i=e.target),this.downNodes.get(r).push(i),this.upNodes.get(i).push(r)},this),this.downNodes.forEachValue(function(e){e.sort(this._gridPositionComparer)},this),this.upNodes.forEachValue(function(e){e.sort(this._gridPositionComparer)},this),n=0;this.layers.length-1>n;++n)for(r=this.layers[n],a=0;r.length-1>a;a++)if(s=r[a],s.isVirtual&&(l=this.downNodes.get(s)[0],l.isVirtual))for(o=a+1;r.length>o;++o)i=r[o],i.isVirtual&&(c=this.downNodes.get(i)[0],c.isVirtual&&l.gridPosition>c.gridPosition&&(u=l.gridPosition,l.gridPosition=c.gridPosition,c.gridPosition=u,h=l.layerIndex,p=c.layerIndex,this.layers[n+1][h]=c,this.layers[n+1][p]=l,l.layerIndex=p,c.layerIndex=h));for(m=this._getLeftWing(),g=this._getRightWing(),v=this.placeLeftToRight(m),_=this.placeRightToLeft(g),b=new d,f.forEach(this.graph.nodes,function(e){b.set(e,(v.get(e)+_.get(e))/2)}),w=new d,y=new d,n=0;this.layers.length>n;++n)for(r=this.layers[n],k=-1,x=-1,o=0;r.length>o;++o)i=r[o],w.set(i,0),y.set(i,!1),i.isVirtual&&(-1===k?k=o:k===o-1?k=o:(x=o,w.set(r[k],0),b.get(i)-b.get(r[k])===this.getMinDist(r[k],i)?y.set(r[k],!0):y.set(r[k],!1),k=o));for(C=[1,-1],f.forEach(C,function(e){var n,i,r,o,a,s,l,c=1===e?0:this.layers.length-1;for(n=c;n>=0&&this.layers.length>n;n+=e){if(i=this.layers[n],r=this._firstVirtualNode(i),o=null,a=null,-1!==r)for(o=i[r],a=[],t=0;r>t;t++)a.push(i[t]);else o=null,a=i;if(a.length>0){for(this._sequencer(b,null,o,e,a),t=0;a.length-1>t;++t)this.setMinDist(a[t],a[t+1],b.get(a[t+1])-b.get(a[t]));o&&this.setMinDist(a[a.length-1],o,b.get(o)-b.get(a[a.length-1]))}for(;o;){if(s=this.nextVirtualNode(i,o)){if(w.get(o)===e){for(r=o.layerIndex,l=s.layerIndex,a=[],t=r+1;l>t;t++)a.push(i[t]);a.length>0&&this._sequencer(b,o,s,e,a),y.set(o,!0)}}else{for(r=o.layerIndex,a=[],t=r+1;i.length>t;t++)a.push(i[t]);if(a.length>0){for(this._sequencer(b,o,null,e,a),t=0;a.length-1>t;++t)this.setMinDist(a[t],a[t+1],b.get(a[t+1])-b.get(a[t]));this.setMinDist(o,a[0],b.get(a[0])-b.get(o))}}o=s}this.adjustDirections(n,e,w,y)}},this),S=this._isIncreasingLayout()?0:this.layers.length-1,T=function(e,t){return t._isIncreasingLayout()?t.layers.length>e:e>=0},D=this._isIncreasingLayout()?1:-1,A=0,t=S;T(t,this);t+=D){for(r=this.layers[t],E=e(r,this),o=0;r.length>o;++o)i=r[o],this._isVerticalLayout()?(i.x=b.get(i),i.y=A+E/2):(i.x=A+E/2,i.y=b.get(i));A+=this.options.layerSeparation+E}},adjustDirections:function(e,t,n,i){var r,o,a,s,l,c,d,u,h,f,p,m,g,v;if(!(0>e+t||e+t>=this.layers.length))for(r=null,o=null,a=this.layers[e+t],s=0;a.length>s;++s)if(l=a[s],l.isVirtual&&(c=this.getNeighborOnLayer(l,e),c.isVirtual)){if(r){for(d=i.get(o),u=this.layers[e],h=o.layerIndex,f=c.layerIndex,p=h+1;f>p;++p)u[p].isVirtual&&(d=d&&i.get(u[p]));if(d)for(n.set(r,t),m=r.layerIndex,g=l.layerIndex,v=m+1;g>v;++v)a[v].isVirtual&&n.set(a[v],t)}r=l,o=c}},getNeighborOnLayer:function(e,t){var n=this.upNodes.get(e)[0];return n.layer===t?n:(n=this.downNodes.get(e)[0],n.layer===t?n:null)},_sequencer:function(e,t,n,i,r){if(1===r.length&&this._sequenceSingle(e,t,n,i,r[0]),r.length>1){var o=r.length,a=this.intDiv(o,2);this._sequencer(e,t,n,i,r.slice(0,a)),this._sequencer(e,t,n,i,r.slice(a)),this.combineSequences(e,t,n,i,r)}},_sequenceSingle:function(e,t,n,i,r){var o=-1===i?this.downNodes.get(r):this.upNodes.get(r),a=o.length;0!==a&&(a%2===1?e.set(r,e.get(o[this.intDiv(a,2)])):e.set(r,(e.get(o[this.intDiv(a,2)-1])+e.get(o[this.intDiv(a,2)]))/2),t&&e.set(r,Math.max(e.get(r),e.get(t)+this.getMinDist(t,r))),n&&e.set(r,Math.min(e.get(r),e.get(n)-this.getMinDist(r,n))))},combineSequences:function(e,t,n,i,r){var o,a,s,l,c,d,u,h,f,p,m=r.length,g=this.intDiv(m,2),v=[];for(o=0;g>o;++o){for(a=0,l=-1===i?this.downNodes.get(r[o]):this.upNodes.get(r[o]),s=0;l.length>s;++s)c=l[s],e.get(c)>=e.get(r[o])?a++:(a--,v.push({k:e.get(c)+this.getMinDist(r[o],r[g-1]),v:2}));v.push({k:e.get(r[o])+this.getMinDist(r[o],r[g-1]),v:a})}for(t&&v.push({k:e.get(t)+this.getMinDist(t,r[g-1]),v:Number.MAX_VALUE}),v.sort(this._positionDescendingComparer),u=[],o=g;m>o;++o){for(a=0,l=-1===i?this.downNodes.get(r[o]):this.upNodes.get(r[o]),s=0;l.length>s;++s)c=l[s],e.get(c)<=e.get(r[o])?a++:(a--,u.push({k:e.get(c)-this.getMinDist(r[o],r[g]),v:2}));u.push({k:e.get(r[o])-this.getMinDist(r[o],r[g]),v:a})}for(n&&u.push({k:e.get(n)-this.getMinDist(n,r[g]),v:Number.MAX_VALUE}),u.sort(this._positionAscendingComparer),h=0,f=0,p=this.getMinDist(r[g-1],r[g]);e.get(r[g])-e.get(r[g-1]) h){if(0===v.length){e.set(r[g-1],e.get(r[g])-p);break}d=v.shift(),h+=d.v,e.set(r[g-1],d.k),e.set(r[g-1],Math.max(e.get(r[g-1]),e.get(r[g])-p))}else{if(0===u.length){e.set(r[g],e.get(r[g-1])+p);break}d=u.shift(),f+=d.v,e.set(r[g],d.k),e.set(r[g],Math.min(e.get(r[g]),e.get(r[g-1])+p))}for(o=g-2;o>=0;o--)e.set(r[o],Math.min(e.get(r[o]),e.get(r[g-1])-this.getMinDist(r[o],r[g-1])));for(o=g+1;m>o;o++)e.set(r[o],Math.max(e.get(r[o]),e.get(r[g])+this.getMinDist(r[o],r[g])))},placeLeft:function(e,t,n){var i=Number.NEGATIVE_INFINITY;f.forEach(this._getComposite(e),function(e){var r=this.leftSibling(e);r&&this.nodeLeftClass.get(r)===this.nodeLeftClass.get(e)&&(t.containsKey(r)||this.placeLeft(r,t,n),i=Math.max(i,t.get(r)+this.getMinDist(r,e)))},this),i===Number.NEGATIVE_INFINITY&&(i=0),f.forEach(this._getComposite(e),function(e){t.set(e,i)})},placeRight:function(e,t,n){var i=Number.POSITIVE_INFINITY;f.forEach(this._getComposite(e),function(e){var r=this.rightSibling(e);r&&this.nodeRightClass.get(r)===this.nodeRightClass.get(e)&&(t.containsKey(r)||this.placeRight(r,t,n),i=Math.min(i,t.get(r)-this.getMinDist(e,r)))},this),i===Number.POSITIVE_INFINITY&&(i=0),f.forEach(this._getComposite(e),function(e){t.set(e,i)})},leftSibling:function(e){var t=this.layers[e.layer],n=e.layerIndex;return 0===n?null:t[n-1]},rightSibling:function(e){var t=this.layers[e.layer],n=e.layerIndex;return n===t.length-1?null:t[n+1]},_getComposite:function(e){return e.isVirtual?this._nodesInLink(e):[e]},arrangeNodes:function(){var e,t,n,i,r,o,a,s;for(t=0;this.layers.length>t;t++)for(i=this.layers[t],n=0;i.length>n;n++)r=i[n],r.upstreamPriority=r.upstreamLinkCount,r.downstreamPriority=r.downstreamLinkCount;for(o=2,a=0;o>a;a++){for(e=this.layers.length-1;e>=1;e--)this.layoutLayer(!1,e);for(e=0;this.layers.length-1>e;e++)this.layoutLayer(!0,e)}for(s=Number.MAX_VALUE,t=0;this.layers.length>t;t++)for(i=this.layers[t],n=0;i.length>n;n++)r=i[n],s=Math.min(s,r.gridPosition);if(0>s)for(t=0;this.layers.length>t;t++)for(i=this.layers[t],n=0;i.length>n;n++)r=i[n],r.gridPosition=r.gridPosition-s},layoutLayer:function(e,t){var n,i,r,o;for(i=e?this.layers[n=t+1]:this.layers[n=t-1],r=[],o=0;i.length>o;o++)r.push(i[o]);r.sort(function(e,t){var n=(e.upstreamPriority+e.downstreamPriority)/2,i=(t.upstreamPriority+t.downstreamPriority)/2;return Math.abs(n-i)<1e-4?0:i>n?1:-1}),f.forEach(r,function(e){var t=e.gridPosition,n=this.calcBaryCenter(e),r=(e.upstreamPriority+e.downstreamPriority)/2;if(!(Math.abs(t-n)<1e-4||Math.abs(t-n)<.2501))if(n>t)for(;n>t&&this.moveRight(e,i,r);)t=e.gridPosition;else for(;t>n&&this.moveLeft(e,i,r);)t=e.gridPosition},this),n>0&&this.calcDownData(n-1),this.layers.length-1>n&&this.calcUpData(n+1)},moveRight:function(e,t,n){var i,r,o=f.indexOf(t,e);return o===t.length-1?(e.gridPosition=e.gridPosition+.5,!0):(i=t[o+1],r=(i.upstreamPriority+i.downstreamPriority)/2,i.gridPosition>e.gridPosition+1?(e.gridPosition=e.gridPosition+.5,!0):r>n||Math.abs(r-n)<1e-4?!1:this.moveRight(i,t,n)?(e.gridPosition=e.gridPosition+.5,!0):!1)},moveLeft:function(e,t,n){var i,r,o=f.indexOf(t,e);return 0===o?(e.gridPosition=e.gridPosition-.5,!0):(i=t[o-1],r=(i.upstreamPriority+i.downstreamPriority)/2,e.gridPosition-1>i.gridPosition?(e.gridPosition=e.gridPosition-.5,!0):r>n||Math.abs(r-n)<1e-4?!1:this.moveLeft(i,t,n)?(e.gridPosition=e.gridPosition-.5,!0):!1)},mapVirtualNode:function(e,t){this.nodeToLinkMap.set(e,t),this.linkToNodeMap.containsKey(t)||this.linkToNodeMap.set(t,[]),this.linkToNodeMap.get(t).push(e)},_nodesInLink:function(e){return this.linkToNodeMap.get(this.nodeToLinkMap.get(e))},_dummify:function(){var e,t,n,i,r,s,l,c,u,h,p,m,g,v,_,b,w,y,k,x;for(this.linkToNodeMap=new d,this.nodeToLinkMap=new d,u=this.graph.links.slice(0),h=this.layers,p=function(e,t,n){h[e].linksTo[t]=h[e].linksTo[t]||[],h[e].linksTo[t].push(n)},c=0;u.length>c;c++)if(m=u[c],
g=m.source,v=m.target,_=g.layer,b=v.layer,w=g.gridPosition,y=v.gridPosition,k=(y-w)/Math.abs(b-_),x=g,_-b>1){for(l=_-1;l>b;l--){for(n=new o,n.x=g.x,n.y=g.y,n.width=g.width/100,n.height=g.height/100,e=h[l],t=(l-b)*k+w,t>e.length&&(t=e.length),w>=h[_].length-1&&y>=h[b].length-1?t=e.length:0===w&&0===y&&(t=0),n.layer=l,n.uBaryCenter=0,n.dBaryCenter=0,n.upstreamLinkCount=0,n.downstreamLinkCount=0,n.gridPosition=t,n.isVirtual=!0,f.insert(e,n,t),r=t+1;e.length>r;r++)i=e[r],i.gridPosition=i.gridPosition+1;s=new a(x,n),s.depthOfDumminess=0,p(l-1,l,s),x=n,this.graph._addNode(n),this.graph.addLink(s),n.index=this.graph.nodes.length-1,this.mapVirtualNode(n,m)}p(b-1,b,s),m.changeSource(x),m.depthOfDumminess=_-b-1}else if(-1>_-b){for(l=_+1;b>l;l++){for(n=new o,n.x=g.x,n.y=g.y,n.width=g.width/100,n.height=g.height/100,e=h[l],t=(l-_)*k+w,t>e.length&&(t=e.length),w>=h[_].length-1&&y>=h[b].length-1?t=e.length:0===w&&0===y&&(t=0),n.layer=l,n.uBaryCenter=0,n.dBaryCenter=0,n.upstreamLinkCount=0,n.downstreamLinkCount=0,n.gridPosition=t,n.isVirtual=!0,t&=t,f.insert(e,n,t),r=t+1;e.length>r;r++)i=e[r],i.gridPosition=i.gridPosition+1;s=new a(x,n),s.depthOfDumminess=0,p(l-1,l,s),x=n,this.graph._addNode(n),this.graph.addLink(s),n.index=this.graph.nodes.length-1,this.mapVirtualNode(n,m)}p(b-1,b,m),m.changeSource(x),m.depthOfDumminess=b-_-1}else p(_,b,m)},_dedummify:function(){for(var e,t,n,i,r,o,a,s,l=!0;l;)for(l=!1,e=0;this.graph.links.length>e;e++)if(t=this.graph.links[e],t.depthOfDumminess){for(n=[],n.unshift({x:t.target.x,y:t.target.y}),n.unshift({x:t.source.x,y:t.source.y}),i=t,r=t.depthOfDumminess,o=0;r>o;o++)a=i.source,s=a.incoming[0],n.unshift({x:s.source.x,y:s.source.y}),i=s;t.changeSource(i.source),t.depthOfDumminess=0,n.length>2?(n.splice(0,1),n.splice(n.length-1),t.points=n):t.points=[],l=!0;break}},_optimizeCrossings:function(){for(var e,t=-1,n=3,i=0;0!==t&&!(i++>n);){for(t=0,e=this.layers.length-1;e>=1;e--)t+=this.optimizeLayerCrossings(!1,e);for(e=0;this.layers.length-1>e;e++)t+=this.optimizeLayerCrossings(!0,e)}},calcUpData:function(e){var t,n,i,r,o,a,s,l,c;if(0!==e){for(t=this.layers[e],o=new u,a=this.layers[e-1],n=0;a.length>n;n++)o.add(a[n]);for(n=0;t.length>n;n++){for(s=t[n],l=0,c=0,i=0;s.incoming.length>i;i++)r=s.incoming[i],o.contains(r.source)&&(c++,l+=r.source.gridPosition);for(i=0;s.outgoing.length>i;i++)r=s.outgoing[i],o.contains(r.target)&&(c++,l+=r.target.gridPosition);c>0?(s.uBaryCenter=l/c,s.upstreamLinkCount=c):(s.uBaryCenter=n,s.upstreamLinkCount=0)}}},calcDownData:function(e){var t,n,i,r,o,a,s,l,c;if(e!==this.layers.length-1){for(t=this.layers[e],o=new u,a=this.layers[e+1],n=0;a.length>n;n++)o.add(a[n]);for(n=0;t.length>n;n++){for(s=t[n],l=0,c=0,i=0;s.incoming.length>i;i++)r=s.incoming[i],o.contains(r.source)&&(c++,l+=r.source.gridPosition);for(i=0;s.outgoing.length>i;i++)r=s.outgoing[i],o.contains(r.target)&&(c++,l+=r.target.gridPosition);c>0?(s.dBaryCenter=l/c,s.downstreamLinkCount=c):(s.dBaryCenter=n,s.downstreamLinkCount=0)}}},optimizeLayerCrossings:function(e,t){var n,i,r,o,a,s,l,c;for(i=e?this.layers[n=t+1]:this.layers[n=t-1],r=i.slice(0),e?this.calcUpData(n):this.calcDownData(n),o=this,i.sort(function(e,t){var n,i=o.calcBaryCenter(e),r=o.calcBaryCenter(t);return Math.abs(i-r)<1e-4?e.degree()===t.degree()?o.compareByIndex(e,t):e.degree()0?-1:0>n?1:o.compareByIndex(e,t))}),s=0,a=0;i.length>a;a++)i[a]!==r[a]&&s++;if(s>0)for(l=0,a=0;i.length>a;a++)c=i[a],c.gridPosition=l++;return s},_swapPairs:function(){for(var e,t,n,i,r,o,a,s,l,c,d,u,h,f,p,m,g,v=this.options.layeredIterations,_=0;;){if(_++>v)break;for(e=1>=_%4,t=_%4===1,n=e?0:this.layers.length-1;e?this.layers.length-1>=n:n>=0;n+=e?1:-1){for(i=this.layers[n],r=!1,o=!0,a=0,s=0;i.length-1>s;s++)l=0,c=0,d=0,o?(0!==n&&(l=this.countLinksCrossingBetweenTwoLayers(n-1,n)),n!==this.layers.length-1&&(c=this.countLinksCrossingBetweenTwoLayers(n,n+1)),e?l*=2:c*=2,d=l+c):d=a,0!==d&&(u=i[s],h=i[s+1],f=u.gridPosition,p=h.gridPosition,i[s]=h,i[s+1]=u,u.gridPosition=p,h.gridPosition=f,l=0,0!==n&&(l=this.countLinksCrossingBetweenTwoLayers(n-1,n)),c=0,n!==this.layers.length-1&&(c=this.countLinksCrossingBetweenTwoLayers(n,n+1)),e?l*=2:c*=2,m=l+c,g=!1,g=t?m>=d:m>d,g?(u=i[s],h=i[s+1],f=u.gridPosition,p=h.gridPosition,i[s]=h,i[s+1]=u,u.gridPosition=p,h.gridPosition=f,a=d,o=!1):(r=!0,o=!0));r&&(n!==this.layers.length-1&&this.calcUpData(n+1),0!==n&&this.calcDownData(n-1))}}},countLinksCrossingBetweenTwoLayers:function(e,t){var n,i,r,o,a,s,l,c,d,u,h,f,p=this.layers[e].linksTo[t],m=0,g=p.length;for(l=0;g>l;l++)for(n=p[l],c=l+1;g>c;c++)i=p[c],n.target.layer===t?(r=n.source,o=n.target):(r=n.target,o=n.source),i.target.layer===t?(a=i.source,s=i.target):(a=i.target,s=i.source),d=r.gridPosition,u=o.gridPosition,h=a.gridPosition,f=s.gridPosition,0>(d-h)*(u-f)&&m++;return m},calcBaryCenter:function(e){var t=e.upstreamLinkCount,n=e.downstreamLinkCount,i=e.uBaryCenter,r=e.dBaryCenter;return t>0&&n>0?(i+r)/2:t>0?i:n>0?r:0},_gridPositionComparer:function(e,t){return t.gridPosition>e.gridPosition?-1:e.gridPosition>t.gridPosition?1:0},_positionAscendingComparer:function(e,t){return t.k>e.k?-1:e.k>t.k?1:0},_positionDescendingComparer:function(e,t){return t.k>e.k?1:e.k>t.k?-1:0},_firstVirtualNode:function(e){for(var t=0;e.length>t;t++)if(e[t].isVirtual)return t;return-1},compareByIndex:function(e,t){var n=e.index,i=t.index;return i>n?1:n>i?-1:0},intDiv:function(e,t){return(e-e%t)/t},nextVirtualNode:function(e,t){var n,i=t.layerIndex;for(n=i+1;e.length>n;++n)if(e[n].isVirtual)return e[n];return null}}),S=n.Class.extend({init:function(e,t){if(f.isUndefined(e))throw"No diagram given";this.diagram=e,this.nodeMap=new d,this.linkMap=new d,this.capture(t?t:e)},capture:function(e){var t,n,r,o,a,s,l,d,u;if(e instanceof i.Graph){for(o=0;e.nodes.length>o;o++)t=e.nodes[o],r=t.associatedShape,this.nodeMap.set(r.visual.id,new c(t.x,t.y,t.width,t.height));for(o=0;e.links.length>o;o++)s=e.links[o],a=s.associatedConnection,this.linkMap.set(a.visual.id,s.points())}else if(e instanceof Array)for(n=e,o=0;n.length>o;o++)t=n[o],r=t.associatedShape,r&&this.nodeMap.set(r.visual.id,new c(t.x,t.y,t.width,t.height));else if(e.hasOwnProperty("links")&&e.hasOwnProperty("nodes")){for(n=e.nodes,l=e.links,o=0;n.length>o;o++)t=n[o],r=t.associatedShape,r&&this.nodeMap.set(r.visual.id,new c(t.x,t.y,t.width,t.height));for(o=0;l.length>o;o++)s=l[o],a=s.associatedConnection,a&&this.linkMap.set(a.visual.id,s.points)}else{for(d=this.diagram.shapes,u=this.diagram.connections,o=0;d.length>o;o++)r=d[o],this.nodeMap.set(r.visual.id,r.bounds());for(o=0;u.length>o;o++)a=u[o],this.linkMap.set(a.visual.id,a.points())}}});s(i,{init:function(e){n.init(e,i.ui)},SpringLayout:y,TreeLayout:x,GraphAdapter:w,LayeredLayout:C,LayoutBase:b,LayoutState:S})}(window.kendo.jQuery)},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("dataviz/diagram/dom.min",["kendo.data.min","kendo.draganddrop.min","kendo.toolbar.min","kendo.editable.min","kendo.window.min","kendo.dropdownlist.min","kendo.dataviz.core.min","kendo.dataviz.themes.min","dataviz/diagram/svg.min","dataviz/diagram/services.min","dataviz/diagram/layout.min"],e)}(function(){!function(e,t){function n(e){var t=e.originalEvent,n=0;return t.wheelDelta?(n=-t.wheelDelta/40,n=n>0?_e.ceil(n):_e.floor(n)):t.detail&&(n=t.detail),n}function i(e){return e.options.name.toLowerCase()===Fe.toLowerCase()}function r(e,t){var n,r,o,a,s=ze,l=t.connectors;for(r=0;l.length>r;r++)o=l[r],i(o)||(a=e.distanceTo(o.position()),s>a&&(s=a,n=o));return n}function o(e,t){var n,i,r,o=[],a=e.drawingContainer().children,s=a.length;for(n=0;t.length>n;n++)for(i=t[n],r=0;s>r;r++)if(a[r]==i.drawingContainer()){o.push(r);break}return o}function a(e){var t={};return e=e||{},fe(e.text)&&null!==e.text&&(t.text=e.text),fe(e.x)&&null!==e.x&&(t.x=e.x),fe(e.y)&&null!==e.y&&(t.y=e.y),fe(e.width)&&null!==e.width&&(t.width=e.width),fe(e.height)&&null!==e.height&&(t.height=e.height),fe(e.type)&&null!==e.type&&(t.type=e.type),t}function s(e){var t={};return e=e||{},fe(e.text)&&null!==e.text&&(t.content=e.text),fe(e.type)&&null!==e.type&&(t.type=e.type),fe(e.from)&&null!==e.from&&(t.from=e.from),fe(e.fromConnector)&&null!==e.fromConnector&&(t.fromConnector=e.fromConnector),fe(e.fromX)&&null!==e.fromX&&(t.fromX=e.fromX),fe(e.fromY)&&null!==e.fromY&&(t.fromY=e.fromY),fe(e.to)&&null!==e.to&&(t.to=e.to),fe(e.toConnector)&&null!==e.toConnector&&(t.toConnector=e.toConnector),fe(e.toX)&&null!==e.toX&&(t.toX=e.toX),fe(e.toY)&&null!==e.toY&&(t.toY=e.toY),t}function l(t,n){var i,r=this.dataSource.reader.model;r&&(i=r.fn.fields.text?"text":r.idField,e(" ").appendTo(t).kendoDropDownList({dataValueField:r.idField,dataTextField:i,dataSource:this.dataSource.data().toJSON(),optionLabel:" ",valuePrimitive:!0}))}function c(e){this.dataItem=e,this.callbacks=[]}function d(){this.items={}}function u(e){var t=e;return e instanceof kendo.data.Model&&(t=e.toJSON(),t[e.idField]=e._defaultId),t}function h(e){var t,n,i=[],r=[];for(n=0;e.length>n;n++)t=e[n],t instanceof w?r.push(t):i.push(t);return{shapes:r,connections:i}}function f(e,t){return e.reader.model?new e.reader.model(t):new kendo.data.ObservableObject(t)}function p(e,t){fe(t[e])&&t.set(e,null)}function m(e,t,n){var i,r;for(r=0;n.length>r;r++)i=n[r],t&&!fe(t[i])&&(t[i]=e[i])}function g(e){var t=e.drawingContainer().clippedBBox(null);(0!==t.origin.x||0!==t.origin.y)&&e.position(-t.origin.x,-t.origin.y)}var v,_,b,w,y,k,x,C,S,T,D,A,E=kendo.dataviz,F=kendo.drawing,I=kendo.geometry,M=E.diagram,R=kendo.ui.Widget,P=kendo.Class,z=e.proxy,B=kendo.deepExtend,L=e.extend,H=kendo.data.HierarchicalDataSource,N=M.Canvas,O=M.Group,V=M.Rectangle,U=M.Circle,W=M.CompositeTransform,j=M.Rect,q=M.Path,G=M.DeleteShapeUnit,$=M.DeleteConnectionUnit,Y=M.TextBlock,K=M.Image,Q=M.Point,X=M.Intersect,J=M.ConnectionEditAdorner,Z=M.UndoRedoService,ee=M.ToolService,te=M.Selector,ne=M.ResizingAdorner,ie=M.ConnectorsAdorner,re=M.Cursors,oe=M.Utils,ae=kendo.Observable,se=M.ToBackUnit,le=M.ToFrontUnit,ce=M.PolylineRouter,de=M.CascadingRouter,ue=oe.isUndefined,he=oe.isDefined,fe=kendo.util.defined,pe=e.isArray,me=kendo.isFunction,ge=oe.isString,ve=e.isPlainObject,_e=Math,be=".kendoDiagram",we="cascading",ye="itemBoundsChange",ke="change",xe="click",Ce="drag",Se="dragEnd",Te="dragStart",De="mouseEnter",Ae="mouseLeave",Ee="error",Fe="Auto",Ie="Top",Me="Right",Re="Left",Pe="Bottom",ze=9007199254740992,Be="select",Le="itemRotate",He="pan",Ne="zoomStart",Oe="zoomEnd",Ve="none",Ue=600,We=600,je="rectangle",qe=100,Ge=100,$e=20,Ye=20,Ke=0,Qe="Yellow",Xe=Number.MAX_VALUE,Je=-Number.MAX_VALUE,Ze="absolute",et="transformed",tt="rotated",nt="transparent",it="width",rt="height",ot="x",at="y",st="DOMMouseScroll"+be+" mousewheel"+be,lt=.05,ct=5,dt=' #=text# ',ut=5;M.DefaultConnectors=[{name:Ie},{name:Pe},{name:Re},{name:Me},{name:Fe,position:function(e){return e.getPosition("center")}}],v={cancel:{text:"Cancel",imageClass:"k-cancel",className:"k-diagram-cancel",iconClass:"k-icon"},update:{text:"Update",imageClass:"k-update",className:"k-diagram-update",iconClass:"k-icon"}},M.shapeDefaults=function(e){var t={type:je,path:"",autoSize:!0,visual:null,x:Ke,y:Ke,minWidth:$e,minHeight:Ye,width:qe,height:Ge,hover:{},editable:{connect:!0,tools:[]},connectors:M.DefaultConnectors,rotation:{angle:0}};return oe.simpleExtend(t,e),t},_=ae.extend({init:function(e){var t=this;t.dataItem=(e||{}).dataItem,ae.fn.init.call(t),t.options=B({id:M.randomId()},t.options,e),t.isSelected=!1,t.visual=new O({id:t.options.id,autoSize:t.options.autoSize}),t.id=t.options.id,t._template()},options:{hover:{},cursor:re.grip,content:{align:"center middle"},selectable:!0,serializable:!0,enable:!0},_getCursor:function(e){return this.adorner?this.adorner._getCursor(e):this.options.cursor},visible:function(e){return ue(e)?this.visual.visible():(this.visual.visible(e),t)},bounds:function(){},refresh:function(){this.visual.redraw()},position:function(e){this.options.x=e.x,this.options.y=e.y,this.visual.position(e)},toString:function(){return this.options.id},serialize:function(){var e=B({},{options:this.options});return this.dataItem&&(e.dataItem=""+this.dataItem),e},_content:function(e){var n,i,r;return e!==t&&(n=this.options,M.Utils.isString(e)?n.content.text=e:B(n.content,e),i=n.content,r=this._contentVisual,r?this._updateContentVisual(i):this._createContentVisual(i)),this.options.content.text},_createContentVisual:function(e){e.text&&(this._contentVisual=new Y(e),this._contentVisual._includeInBBox=!1,this.visual.append(this._contentVisual))},_updateContentVisual:function(e){this._contentVisual.redraw(e)},_hitTest:function(e){var t=this.bounds();return this.visible()&&t.contains(e)&&this.options.enable},_template:function(){var e,t,n=this;n.options.content.template&&(e=n.dataItem||{},t=kendo.template(n.options.content.template,{paramName:"dataItem"}),n.options.content.text=t(e))},_canSelect:function(){return this.options.selectable!==!1},toJSON:function(){return{id:this.options.id}}}),b=P.extend({init:function(e,t){this.options=B({},this.options,t),this.connections=[],this.shape=e},options:{width:7,height:7,fill:{color:Qe},hover:{}},position:function(){return this.options.position?this.options.position(this.shape):this.shape.getPosition(this.options.name)},toJSON:function(){return{shapeId:""+this.shape,connector:this.options.name}}}),b.parse=function(e,t){var n,i,r=t.split(":"),o=r[0],a=r[1]||Fe;for(n=0;e.shapes.length>n;n++)if(i=e.shapes[n],i.options.id==o)return i.getConnector(a.trim())},w=_.extend({init:function(e,t){var n=this;_.fn.init.call(n,e),this.diagram=t,this.updateOptionsFromModel(),e=n.options,n.connectors=[],n.type=e.type,n.createShapeVisual(),n.updateBounds(),n.content(n.content()),n._createConnectors()},options:M.shapeDefaults(),_setOptionsFromModel:function(e){var t=a(e||this.dataItem);this.options=B({},this.options,t),this.redrawVisual(),this.options.content&&(this._template(),this.content(this.options.content))},updateOptionsFromModel:function(e,t){var n,i;this.diagram&&this.diagram._isEditable&&(n=a(e||this.dataItem),e&&t?E.inArray(t,["x","y","width","height"])?(i=this.bounds(),i[t]=e[t],this.bounds(i)):(this.options.visual?this.redrawVisual():n.type&&(this.options=B({},this.options,n),this.redrawVisual()),this.options.content&&(this._template(),this.content(this.options.content))):this.options=B({},this.options,n))},redrawVisual:function(){this.visual.clear(),this._contentVisual=null,this.options.dataItem=this.dataItem,this.createShapeVisual(),this.updateBounds()},updateModel:function(e){var t,n,i=this.diagram;i&&i._isEditable&&(t=this._bounds,n=this.dataItem,n&&(i._suspendModelRefresh(),fe(n.x)&&t.x!==n.x&&n.set("x",t.x),fe(n.y)&&t.y!==n.y&&n.set("y",t.y),fe(n.width)&&t.width!==n.width&&n.set("width",t.width),fe(n.height)&&t.height!==n.height&&n.set("height",t.height),this.dataItem=n,i._resumeModelRefresh(),e&&i._syncShapeChanges()))},updateBounds:function(){var e=this.visual._measure(!0),t=this.options;this.bounds(new j(t.x,t.y,e.width,e.height)),this._rotate(),this._alignContent()},content:function(e){var t=this._content(e);return this._alignContent(),t},_alignContent:function(){var e,t,n,i,r,o=this.options.content||{},a=this._contentVisual;a&&o.align&&(e=this.visual._measure(),t=new M.RectAlign(e),n=a.drawingElement.bbox(null),i=new j(0,0,n.width(),n.height()),r=t.align(i,o.align),a.position(r.topLeft()))},_createConnectors:function(){var e,t,n=this.options,i=n.connectors.length,r=n.connectorDefaults;for(t=0;i>t;t++)e=new b(this,B({},r,n.connectors[t])),this.connectors.push(e)},bounds:function(e){var t,n;if(e)if(ge(e))switch(e){case et:t=this._transformedBounds();break;case Ze:t=this._transformedBounds(),n=this.diagram._pan,t.x+=n.x,t.y+=n.y;break;case tt:t=this._rotatedBounds();break;default:t=this._bounds}else this._setBounds(e),this._triggerBoundsChange(),this.diagram&&this.diagram._layouting||this.refreshConnections();else t=this._bounds;return t},_setBounds:function(e){var t=this.options,n=e.topLeft(),i=t.x=n.x,r=t.y=n.y,o=t.width=_e.max(e.width,t.minWidth),a=t.height=_e.max(e.height,t.minHeight);this._bounds=new j(i,r,o,a),this.visual.redraw({x:i,y:r,width:o,height:a})},position:function(e){return e?(this.bounds(new j(e.x,e.y,this._bounds.width,this._bounds.height)),t):this._bounds.topLeft()},clone:function(){var e=this.serialize();return e.options.id=M.randomId(),this.diagram&&this.diagram._isEditable&&fe(this.dataItem)&&(e.options.dataItem=u(this.dataItem)),new w(e.options)},select:function(e){var n,i,r=this.diagram;return ue(e)&&(e=!0),this._canSelect()&&this.isSelected!=e?(n=[],i=[],this.isSelected=e,this.isSelected?(r._selectedItems.push(this),n.push(this)):(oe.remove(r._selectedItems,this),i.push(this)),r._internalSelection||r._selectionChanged(n,i),!0):t},rotate:function(e,n,i){var r,o,a,s,l=this.visual.rotate();return e!==t&&(i!==!1&&this.diagram&&this.diagram.undoRedoService&&e!==l.angle&&this.diagram.undoRedoService.add(new M.RotateUnit(this.diagram._resizingAdorner,[this],[l.angle]),!1),r=this.bounds(),o=new Q(r.width/2,r.height/2),n&&(a=e-l.angle,s=r.center().rotate(n,360-a).minus(o),this._rotationOffset=this._rotationOffset.plus(s.minus(r.topLeft())),this.position(s)),this.visual.rotate(e,o),this.options.rotation.angle=e,this.diagram&&this.diagram._connectorsAdorner&&this.diagram._connectorsAdorner.refresh(),this.refreshConnections(),this.diagram&&this.diagram.trigger(Le,{item:this})),l},connections:function(e){var t,n,i,r,o,a,s,l=[];for(t=0;this.connectors.length>t;t++)for(o=this.connectors[t],r=o.connections,n=0,r;r.length>n;n++)i=r[n],"out"==e?(a=i.source(),a.shape&&a.shape==this&&l.push(i)):"in"==e?(s=i.target(),s.shape&&s.shape==this&&l.push(i)):l.push(i);return l},refreshConnections:function(){e.each(this.connections(),function(){this.refresh()})},getConnector:function(e){var t,n;if(!ge(e))return e instanceof Q?r(e,this):this.connectors.length?this.connectors[0]:null;for(e=e.toLocaleLowerCase(),t=0;this.connectors.length>t;t++)if(n=this.connectors[t],n.options.name.toLocaleLowerCase()==e)return n},getPosition:function(e){var t=this.bounds(),n=e.charAt(0).toLowerCase()+e.slice(1);return me(t[n])?this._transformPoint(t[n]()):t.center()},redraw:function(e){var t,n;e&&(t=this.options,this.shapeVisual.redraw(this._visualOptions(e)),this._diffNumericOptions(e,[it,rt,ot,at])&&(this.bounds(new j(t.x,t.y,t.width,t.height)),n=!0),e.connectors&&(t.connectors=e.connectors,this._updateConnectors()),t=B(t,e),(e.rotation||n)&&this._rotate(),t.content&&this.content(t.content))},_updateConnectors:function(){var e,t,n,i,r=this.connections();for(this.connectors=[],this._createConnectors(),i=0;r.length>i;i++)e=r[i],t=e.source(),n=e.target(),t.shape&&t.shape===this?e.source(this.getConnector(t.options.name)||null):n.shape&&n.shape===this&&e.target(this.getConnector(n.options.name)||null),e.updateModel()},_diffNumericOptions:M.diffNumericOptions,_visualOptions:function(e){return{data:e.path,source:e.source,hover:e.hover,fill:e.fill,stroke:e.stroke}},_triggerBoundsChange:function(){this.diagram&&this.diagram.trigger(ye,{item:this,bounds:this._bounds.clone()})},_transformPoint:function(e){var t=this.rotate(),n=this.bounds(),i=n.topLeft();return t.angle&&e.rotate(t.center().plus(i),360-t.angle),e},_transformedBounds:function(){var e=this.bounds(),t=e.topLeft(),n=e.bottomRight();return j.fromPoints(this.diagram.modelToView(t),this.diagram.modelToView(n))},_rotatedBounds:function(){var e=this.bounds().rotatedBounds(this.rotate().angle),t=e.topLeft(),n=e.bottomRight();return j.fromPoints(t,n)},_rotate:function(){var e=this.options.rotation;e&&e.angle&&this.rotate(e.angle),this._rotationOffset=new Q},_hover:function(e){var t=this.options,n=t.hover,i=t.stroke,r=t.fill;e&&he(n.stroke)&&(i=B({},i,n.stroke)),e&&he(n.fill)&&(r=n.fill),this.shapeVisual.redraw({stroke:i,fill:r}),t.editable&&t.editable.connect&&this.diagram._showConnectors(this,e)},_hitTest:function(e){if(this.visible()){var t,n=this.bounds(),i=this.rotate().angle;if(e.isEmpty&&!e.isEmpty())return X.rects(e,n,i?i:0);if(t=e.clone().rotate(n.center(),i),n.contains(t))return this}},toJSON:function(){return{shapeId:this.options.id}},createShapeVisual:function(){var e,t=this.options,n=this._visualOptions(t),i=t.visual,r=(t.type+"").toLocaleLowerCase();n.width=t.width,n.height=t.height,me(i)?e=i.call(this,t):n.data?(e=new q(n),g(e)):e="rectangle"==r?new V(n):"circle"==r?new U(n):"text"==r?new Y(n):"image"==r?new K(n):new q(n),this.shapeVisual=e,this.visual.append(this.shapeVisual)}}),y=_.extend({init:function(e,t,n){var i=this;_.fn.init.call(i,n),this.updateOptionsFromModel(),this._initRouter(),i.path=new M.Polyline(i.options),i.path.fill(nt),i.visual.append(i.path),i._sourcePoint=i._targetPoint=new Q,i._setSource(e),i._setTarget(t),i.content(i.options.content),i.definers=[],fe(n)&&n.points&&i.points(n.points)},options:{hover:{stroke:{}},startCap:Ve,endCap:Ve,points:[],selectable:!0,fromConnector:Fe,toConenctor:Fe},_setOptionsFromModel:function(e){this.updateOptionsFromModel(e||this.dataItem)},updateOptionsFromModel:function(e){var t,n,i,r;this.diagram&&this.diagram._isEditable&&(t=this.diagram._dataMap,n=s(e||this.dataItem),e?(fe(n.from)?(i=t[n.from],i&&fe(n.fromConnector)&&(i=i.getConnector(n.fromConnector)),this.source(i)):fe(n.fromX)&&fe(n.fromY)&&this.source(new Q(n.fromX,n.fromY)),fe(n.to)?(r=t[n.to],r&&fe(n.toConnector)&&(r=r.getConnector(n.toConnector)),this.target(r)):fe(n.toX)&&fe(n.toY)&&this.target(new Q(n.toX,n.toY)),fe(n.type)&&this.type()!==n.type&&(this.points([]),this.type(n.type)),this.dataItem=e,this._template(),this.redraw(this.options)):this.options=B({},n,this.options))},updateModel:function(e){if(this.diagram&&this.diagram._isEditable&&this.diagram.connectionsDataSource){var t=this.diagram.connectionsDataSource.getByUid(this.dataItem.uid);t&&(this.diagram._suspendModelRefresh(),fe(this.options.fromX)&&null!==this.options.fromX?(p("from",t),p("fromConnector",t),t.set("fromX",this.options.fromX),t.set("fromY",this.options.fromY)):(t.set("from",this.options.from),fe(t.fromConnector)&&t.set("fromConnector",this.sourceConnector?this.sourceConnector.options.name:null),p("fromX",t),p("fromY",t)),fe(this.options.toX)&&null!==this.options.toX?(p("to",t),p("toConnector",t),t.set("toX",this.options.toX),t.set("toY",this.options.toY)):(t.set("to",this.options.to),fe(t.toConnector)&&t.set("toConnector",this.targetConnector?this.targetConnector.options.name:null),p("toX",t),p("toY",t)),fe(this.options.type)&&fe(t.type)&&t.set("type",this.options.type),this.dataItem=t,this.diagram._resumeModelRefresh(),e&&this.diagram._syncConnectionChanges())}},sourcePoint:function(){return this._resolvedSourceConnector?this._resolvedSourceConnector.position():this._sourcePoint},_setSource:function(e){var n,i=e instanceof w,r=this.options.fromConnector||Fe;(!i||e.getConnector(r))&&(e!==t&&(this.from=e),this._removeFromSourceConnector(),null===e?this.sourceConnector&&(this._sourcePoint=(this._resolvedSourceConnector||this.sourceConnector).position(),this._clearSourceConnector(),this._setFromOptions(null,this._sourcePoint)):e instanceof b?(n=e.shape.dataItem,n&&this._setFromOptions(n.id),this.sourceConnector=e,this.sourceConnector.connections.push(this)):e instanceof Q?(this._setFromOptions(null,e),this._sourcePoint=e,this.sourceConnector&&this._clearSourceConnector()):i&&(n=e.dataItem,n&&this._setFromOptions(n.id),this.sourceConnector=e.getConnector(r),this.sourceConnector.connections.push(this)))},source:function(e,t){return he(e)&&(t&&this.diagram&&this.diagram.undoRedoService.addCompositeItem(new M.ConnectionEditUnit(this,e)),this._setSource(e),this.refresh()),this.sourceConnector?this.sourceConnector:this._sourcePoint},_setFromOptions:function(e,t){this.options.from=e,t?(this.options.fromX=t.x,this.options.fromY=t.y):(this.options.fromX=null,this.options.fromY=null)},sourceDefiner:function(e){if(!e)return this._sourceDefiner||(this._sourceDefiner=new M.PathDefiner(this.sourcePoint(),null,null)),this._sourceDefiner;if(!(e instanceof M.PathDefiner))throw"The sourceDefiner needs to be a PathDefiner.";e.left=null,this._sourceDefiner=e,this.source(e.point)},targetPoint:function(){return this._resolvedTargetConnector?this._resolvedTargetConnector.position():this._targetPoint},_setTarget:function(e){var n,i=e instanceof w,r=this.options.toConnector||Fe;(!i||e.getConnector(r))&&(e!==t&&(this.to=e),this._removeFromTargetConnector(),null===e?this.targetConnector&&(this._targetPoint=(this._resolvedTargetConnector||this.targetConnector).position(),this._clearTargetConnector(),this._setToOptions(null,this._targetPoint)):e instanceof b?(n=e.shape.dataItem,n&&this._setToOptions(n.id),this.targetConnector=e,this.targetConnector.connections.push(this)):e instanceof Q?(this._setToOptions(null,e),this._targetPoint=e,this.targetConnector&&this._clearTargetConnector()):i&&(n=e.dataItem,n&&this._setToOptions(n.id),this.targetConnector=e.getConnector(r),this.targetConnector.connections.push(this)))},target:function(e,n){return he(e)&&(n&&this.diagram&&this.diagram.undoRedoService.addCompositeItem(new M.ConnectionEditUnit(this,t,e)),this._setTarget(e),this.refresh()),this.targetConnector?this.targetConnector:this._targetPoint},_setToOptions:function(e,t){this.options.to=e,t?(this.options.toX=t.x,this.options.toY=t.y):(this.options.toX=null,this.options.toY=null)},targetDefiner:function(e){if(!e)return this._targetDefiner||(this._targetDefiner=new M.PathDefiner(this.targetPoint(),null,null)),this._targetDefiner;if(!(e instanceof M.PathDefiner))throw"The sourceDefiner needs to be a PathDefiner.";e.right=null,this._targetDefiner=e,this.target(e.point)},_updateConnectors:function(){this._updateConnector(this.source(),"source"),this._updateConnector(this.target(),"target")},_updateConnector:function(e,t){var n,i,r,o,a=this,s=a.diagram;e instanceof b&&!s.getShapeById(e.shape.id)?(n=e.shape.dataItem,i=e.options.name,r=function(){var r=s._dataMap[n.id];e=r.getConnector(i),a[t](e,!1),a.updateModel()},s._dataMap[n.id]?r():(o=s._inactiveShapeItems.getByUid(n.uid),o&&s._deferredConnectionUpdates.push(o.onActivate(r)))):a[t](e,!1)},content:function(e){var t=this._content(e);return fe(e)&&this._alignContent(),t},_createContentVisual:function(e){var t;return me(e.visual)?t=e.visual.call(this,e):e.text&&(t=new Y(e)),t&&(this._contentVisual=t,t._includeInBBox=!1,this.visual.append(t)),t},_updateContentVisual:function(e){me(e.visual)?(this.visual.remove(this._contentVisual),this._createContentVisual(e)):this._contentVisual.redraw(e)},_alignContent:function(){var e,t,n,i,r,o,a,s,l,c,d,u,h,f,p,m;if(this._contentVisual){for(e=ut,t=this.allPoints(),n=_e.floor(t.length/2),i=n-1;i>0&&t[i].equals(t[n]);)i--,n++;r=t[n],o=t[i],a=this._contentVisual._measure(),s=a.width,l=a.height,c=t.length%2===0,d=o.distanceTo(r),c&&t.length>2&&d>0&&(o.y===r.y&&s>d||o.x===r.x&&l>d)&&(c=!1,e=0),c?(h=kendo.util.deg(_e.atan2(r.y-o.y,r.x-o.x)),u=new Q((r.x-o.x)/2+o.x,(r.y-o.y)/2+o.y),90===_e.abs(h)?(u.x+=e,u.y-=l/2):h%180===0?(u.x-=s/2,u.y-=l+e):-90>h||h>0&&90>h?u.y-=l:(0>h||h>90)&&(u.x-=s,u.y-=l)):(f=_e.floor(t.length/2),u=t[f].clone(),o=t[f-1],r=t[f+1],p=u.x>=o.x&&u.x>=r.x?e:-a.width-e,m=u.y>=o.y&&u.y>=r.y?e:-a.height-e,u.x+=p,u.y+=m),this._contentVisual.position(u)}},select:function(e){var n,i,r=this.diagram;return this._canSelect()&&this.isSelected!==e?(this.isSelected=e,n=[],i=[],this.isSelected?(this.adorner=new J(this,this.options.selection),r._adorn(this.adorner,!0),r._selectedItems.push(this),n.push(this)):this.adorner&&(r._adorn(this.adorner,!1),oe.remove(r._selectedItems,this),this.adorner=t,i.push(this)),this.adorner&&this.adorner.refresh(),r._internalSelection||r._selectionChanged(n,i),!0):t},bounds:function(e){return!e||ge(e)?this._bounds:(this._bounds=e,t)},type:function(e){var n=this.options;return e?(e!==n.type&&(n.type=e,this._initRouter(),this.refresh()),t):n.type},_initRouter:function(){var e=(this.options.type||"").toLowerCase();this._router=e==we?new de(this):new ce(this)},points:function(e){var t,n,i,r;if(!e){if(i=[],he(this.definers))for(r=0;this.definers.length>r;r++)i.push(this.definers[r].point);return i}for(this.definers=[],t=0;e.length>t;t++)if(n=e[t],n instanceof M.Point)this.definers.push(new M.PathDefiner(n));else{if(!n.hasOwnProperty("x")||!n.hasOwnProperty("y"))throw"A Connection point needs to be a Point or an object with x and y properties.";this.definers.push(new M.PathDefiner(new Q(n.x,n.y)))}},allPoints:function(){var e,t=[this.sourcePoint()];if(this.definers)for(e=0;this.definers.length>e;e++)t.push(this.definers[e].point);return t.push(this.targetPoint()),t},refresh:function(){this._resolveConnectors(),this._refreshPath(),this._alignContent(),this.adorner&&this.adorner.refresh()},_resolveConnectors:function(){var e,t,n,o,a=this,s=a.source(),l=a.target();s instanceof Q?e=s:s instanceof b&&(i(s)?n=s.shape:(a._resolvedSourceConnector=s,e=s.position())),l instanceof Q?t=l:l instanceof b&&(i(l)?o=l.shape:(a._resolvedTargetConnector=l,t=l.position())),e?o&&(a._resolvedTargetConnector=r(e,o)):n&&(t?a._resolvedSourceConnector=r(t,n):o&&this._resolveAutoConnectors(n,o))},_resolveAutoConnectors:function(e,t){var n,r,o,a,s,l,c,d,u,h,f,p,m=ze,g=ze,v=e.connectors;for(h=0;v.length>h;h++)if(d=v[h],!i(d))for(a=d.position(),n=t.connectors,f=0;n.length>f;f++)u=n[f],i(u)||(s=u.position(),p=_e.round(a.distanceTo(s)),m>p&&this.diagram&&this._testRoutePoints(a,s,d,u)&&(m=p,r=d,o=u),g>p&&(l=d,c=u,g=p));r&&(l=r,c=o),this._resolvedSourceConnector=l,this._resolvedTargetConnector=c},_testRoutePoints:function(e,t,n,i){var r,o,a,s,l,c=this._router,d=!0;if(c instanceof de)for(r=c.routePoints(e,t,n,i),r.unshift(e),r.push(t),l=1;r.length>l;l++)if(o=r[l-1],a=r[l],s=new j(_e.min(o.x,a.x),_e.min(o.y,a.y),_e.abs(o.x-a.x),_e.abs(o.y-a.y)),s.width>0&&(s.x++,s.width-=2),s.height>0&&(s.y++,s.height-=2),!s.isEmpty()&&this.diagram._shapesQuadTree.hitTestRect(s)){d=!1;break}return d},redraw:function(e){if(e){this.options=B({},this.options,e);var t=this.options.points;fe(t)&&t.length>0&&(this.points(t),this._refreshPath()),(e&&e.content||e.text)&&this.content(e.content),this.path.redraw({fill:e.fill,stroke:e.stroke,startCap:e.startCap,endCap:e.endCap})}},clone:function(){var e=this.serialize();return this.diagram&&this.diagram._isEditable&&fe(this.dataItem)&&(e.options.dataItem=u(this.dataItem)),new y(this.from,this.to,e.options)},serialize:function(){var e=this.from.toJSON?this.from.toJSON:""+this.from,t=this.to.toJSON?this.to.toJSON:""+this.to,n=B({},{options:this.options,from:e,to:t});return fe(this.dataItem)&&(n.dataItem=""+this.dataItem),n.options.points=this.points(),n},_hitTest:function(e){if(this.visible()){var t=new Q(e.x,e.y),n=this.sourcePoint(),i=this.targetPoint();if(e.isEmpty&&!e.isEmpty()&&e.contains(n)&&e.contains(i))return this;if(this._router.hitTest(t))return this}},_hover:function(e){var t=(this.options.stroke||{}).color;e&&he(this.options.hover.stroke.color)&&(t=this.options.hover.stroke.color),this.path.redraw({stroke:{color:t}})},_refreshPath:function(){fe(this.path)&&(this._drawPath(),this.bounds(this._router.getBounds()))},_drawPath:function(){var e,t,n;this._router&&this._router.route(),e=this.sourcePoint(),t=this.targetPoint(),n=this.points(),this.path.redraw({points:[e].concat(n,[t])})},_clearSourceConnector:function(){this.sourceConnector=t,this._resolvedSourceConnector=t},_clearTargetConnector:function(){this.targetConnector=t,this._resolvedTargetConnector=t},_removeFromSourceConnector:function(){this.sourceConnector&&oe.remove(this.sourceConnector.connections,this)},_removeFromTargetConnector:function(){this.targetConnector&&oe.remove(this.targetConnector.connections,this)},toJSON:function(){var e,t,n,i=this;return i.from&&i.from.toJSON?e=i.from.toJSON():(n=i._sourcePoint,e={x:n.x,y:n.y}),i.to&&i.to.toJSON?t=i.to.toJSON():(n=i._targetPoint,t={x:n.x,y:n.y}),{from:e,to:t}}}),k=R.extend({
init:function(e,t){var n=this;kendo.destroy(e),R.fn.init.call(n,e,t),n._initTheme(),n._initElements(),n._extendLayoutOptions(n.options),n._initDefaults(t),n._initCanvas(),n.mainLayer=new O({id:"main-layer"}),n.canvas.append(n.mainLayer),n._shapesQuadTree=new A(n),n._pan=new Q,n._adorners=[],n.adornerLayer=new O({id:"adorner-layer"}),n.canvas.append(n.adornerLayer),n._createHandlers(),n._initialize(),n._resizingAdorner=new ne(n,{editable:n.options.editable}),n._connectorsAdorner=new ie(n),n._adorn(n._resizingAdorner,!0),n._adorn(n._connectorsAdorner,!0),n.selector=new te(n),n._clipboard=[],n.pauseMouseHandlers=!1,n._fetchFreshData(),n._createGlobalToolBar(),n._createOptionElements(),n.zoom(n.options.zoom),n.canvas.draw()},options:{name:"Diagram",theme:"default",layout:"",zoomRate:.1,zoom:1,zoomMin:0,zoomMax:2,dataSource:{},draggable:!0,template:"",autoBind:!0,editable:{rotate:{},resize:{},text:!0,tools:[],drag:{snap:{size:10,angle:10}},remove:!0},pannable:{key:"ctrl"},selectable:{key:"none"},tooltip:{enabled:!0,format:"{0}"},copy:{enabled:!0,offsetX:20,offsetY:20},shapeDefaults:M.shapeDefaults({undoable:!0}),connectionDefaults:{editable:{tools:[]},type:we},shapes:[],connections:[]},events:[Oe,Ne,He,Be,Le,ye,ke,xe,De,Ae,"toolBarClick","save","cancel","edit","remove","add","dataBound",Te,Ce,Se],items:function(){return e()},_createGlobalToolBar:function(){var e,t=this.options.editable;t&&(e=t.tools,!this._isEditable||e===!1||e&&0!==e.length||(e=["createShape","undo","redo","rotateClockwise","rotateAnticlockwise"]),e&&e.length&&(this.toolBar=new x(this,{tools:e||{},click:z(this._toolBarClick,this),modal:!1}),this.toolBar.element.css({textAlign:"left"}),this.element.prepend(this.toolBar.element),this._resize()))},createShape:function(){var e,t,n,i,r,o;(this.editor&&this.editor.end()||!this.editor)&&(e=this.dataSource,t=e.view()||[],n=t.length,i=f(e,{}),r=this._createShape(i,{}),this.trigger("add",{shape:r})||(e.insert(n,i),o=this._inactiveShapeItems.getByUid(i.uid),o.element=r,this.edit(r)))},_createShape:function(e,t){t=B({},this.options.shapeDefaults,t),t.dataItem=e;var n=new w(t,this);return n},createConnection:function(){var e,t,n,i,r;(this.editor&&this.editor.end()||!this.editor)&&(e=this.connectionsDataSource,t=e.view()||[],n=t.length,i=f(e,{}),r=this._createConnection(i),this.trigger("add",{connection:r})||(this._connectionsDataMap[i.uid]=r,e.insert(n,i),this.addConnection(r,!1),this.edit(r)))},_createConnection:function(e,t,n){var i,r=B({},this.options.connectionDefaults);return r.dataItem=e,i=new y(t||new Q,n||new Q,r)},editModel:function(e,t){var n,i,r,o;if(this.cancelEdit(),r=this.options.editable,"shape"==t)n=r.shapeEditors,i=r.shapeTemplate;else{if("connection"!=t)return;o=z(l,this),n=B({},{from:o,to:o},r.connectionEditors),i=r.connectionTemplate}this.editor=new S(this.element,{update:z(this._update,this),cancel:z(this._cancel,this),model:e,type:t,target:this,editors:n,template:i}),this.trigger("edit",this._editArgs())},edit:function(e){if(e.dataItem){var t=e instanceof w?"shape":"connection";this.editModel(e.dataItem,t)}},cancelEdit:function(){this.editor&&(this._getEditDataSource().cancelChanges(this.editor.model),this._destroyEditor())},saveEdit:function(){this.editor&&this.editor.end()&&!this.trigger("save",this._editArgs())&&this._getEditDataSource().sync()},_update:function(){this.editor&&this.editor.end()&&!this.trigger("save",this._editArgs())&&(this._getEditDataSource().sync(),this._destroyEditor())},_cancel:function(){var e,t;this.editor&&!this.trigger("cancel",this._editArgs())&&(e=this.editor.model,this._getEditDataSource().cancelChanges(e),t=this._connectionsDataMap[e.uid]||this._dataMap[e.id],t&&t._setOptionsFromModel(e),this._destroyEditor())},_getEditDataSource:function(){return"shape"===this.editor.options.type?this.dataSource:this.connectionsDataSource},_editArgs:function(){var e={container:this.editor.wrapper};return e[this.editor.options.type]=this.editor.model,e},_destroyEditor:function(){this.editor&&(this.editor.close(),this.editor=null)},_initElements:function(){this.wrapper=this.element.empty().css("position","relative").attr("tabindex",0).addClass("k-widget k-diagram"),this.scrollable=e("
").appendTo(this.element)},_initDefaults:function(e){var t=this.options,n=t.editable,i=t.shapeDefaults,r=t.connectionDefaults,o=(e||{}).shapeDefaults;n===!1?(i.editable=!1,r.editable=!1):(m(n,i.editable,["drag","remove","connect"]),m(n,r.editable,["drag","remove"])),o&&o.connectors&&(t.shapeDefaults.connectors=o.connectors)},_initCanvas:function(){var t=e("
").appendTo(this.scrollable)[0],n=this.viewport();this.canvas=new N(t,{width:n.width||Ue,height:n.height||We})},_createHandlers:function(){var e=this,t=e.element;t.on(st,z(e._wheel,e)),kendo.support.touch||kendo.support.mobileOS?(e._userEvents=new kendo.UserEvents(t,{multiTouch:!0,tap:z(e._tap,e)}),e._userEvents.bind(["gesturestart","gesturechange","gestureend"],{gesturestart:z(e._gestureStart,e),gesturechange:z(e._gestureChange,e),gestureend:z(e._gestureEnd,e)}),e.toolService=new ee(e),e.options.pannable!==!1&&e.scroller.enable()):(e.toolService=new ee(e),this.scroller.wrapper.on("mousemove"+be,z(e._mouseMove,e)).on("mouseup"+be,z(e._mouseUp,e)).on("mousedown"+be,z(e._mouseDown,e)).on("mouseover"+be,z(e._mouseover,e)).on("mouseout"+be,z(e._mouseout,e)),t.on("keydown"+be,z(e._keydown,e))),this._syncHandler=z(e._syncChanges,e),e._resizeHandler=z(e.resize,e,!1),kendo.onResize(e._resizeHandler),this.bind(Ne,z(e._destroyToolBar,e)),this.bind(He,z(e._destroyToolBar,e))},_tap:function(e){var t,n=this.toolService,i=this._caculateMobilePosition(e);n._updateHoveredItem(i),n.hoveredItem&&(t=n.hoveredItem,this.options.selectable!==!1&&(this._destroyToolBar(),t.isSelected?t.select(!1):this.select(t,{addToSelection:!0}),this._createToolBar()),this.trigger("click",{item:t,point:i}))},_caculateMobilePosition:function(e){return this.documentToModel(Q(e.x.location,e.y.location))},_gestureStart:function(e){var t,n;this._destroyToolBar(),this.scroller.disable(),t=this.documentToModel(new Q(e.center.x,e.center.y)),n={point:t,zoom:this.zoom()},this.trigger(Ne,n)||(this._gesture=e,this._initialCenter=t)},_gestureChange:function(e){var t,n,i=this._gesture,r=this._initialCenter,o=this.documentToView(new Q(e.center.x,e.center.y)),a=e.distance/i.distance,s=this._zoom,l=!1;_e.abs(a-1)>=lt&&(this._zoom=s=this._getValidZoom(s*a),this.options.zoom=s,this._gesture=e,l=!0),t=r.times(s),n=o.minus(t),(l||this._pan.distanceTo(n)>=ct)&&(this._panTransform(n),this._updateAdorners()),e.preventDefault()},_gestureEnd:function(){this.options.pannable!==!1&&this.scroller.enable(),this.trigger(Oe,{point:this._initialCenter,zoom:this.zoom()})},_resize:function(){var e=this.viewport();this.canvas&&this.canvas.size(e),this.scrollable&&this.toolBar&&this.scrollable.height(e.height)},_mouseover:function(e){var t=e.target._kendoNode;t&&t.srcElement._hover&&t.srcElement._hover(!0,t.srcElement)},_mouseout:function(e){var t=e.target._kendoNode;t&&t.srcElement._hover&&t.srcElement._hover(!1,t.srcElement)},_initTheme:function(){var e=this,t=E.ui.themes||{},n=((e.options||{}).theme||"").toLowerCase(),i=(t[n]||{}).diagram;e.options=B({},i,e.options),e.options.editable===!0&&B(e.options,{editable:(i||{}).editable})},_createOptionElements:function(){var e=this.options,t=e.shapes.length;t&&this._createShapes(),e.connections.length&&this._createConnections(),t&&e.layout&&this.layout(e.layout)},_createShapes:function(){var e,t,n=this,i=n.options,r=i.shapes;for(t=0;r.length>t;t++)e=r[t],n.addShape(e)},_createConnections:function(){var e,t,n,i,r=this,o=r.options,a=o.connectionDefaults,s=o.connections;for(i=0;s.length>i;i++)e=s[i],t=r._findConnectionTarget(e.from),n=r._findConnectionTarget(e.to),r.connect(t,n,B({},a,e))},_findConnectionTarget:function(e){var t,n=this,i=ge(e)?e:e.shapeId||e.id;return i?(t=n.getShapeById(i),e.connector&&(t=t.getConnector(e.connector))):t=new Q(e.x||0,e.y||0),t},destroy:function(){var e=this;R.fn.destroy.call(e),this._userEvents&&this._userEvents.destroy(),kendo.unbindResize(e._resizeHandler),e.clear(),e.element.off(be),e.scroller.wrapper.off(be),e.canvas.destroy(!0),e.canvas=t,e._destroyEditor(),e.destroyScroller(),e._destroyGlobalToolBar(),e._destroyToolBar()},destroyScroller:function(){var e=this.scroller;e&&(e.destroy(),e.element.remove(),this.scroller=null)},save:function(){var e,t,n,i={shapes:[],connections:[]};for(e=0;this.shapes.length>e;e++)n=this.shapes[e],n.options.serializable&&i.shapes.push(n.options);for(e=0;this.connections.length>e;e++)t=this.connections[e],i.connections.push(B({},t.options,t.toJSON()));return i},focus:function(){if(!this.element.is(kendo._activeElement())){var e,t=this.element,n=t[0],i=[],r=[],o=document.documentElement;do n=n.parentNode,n.scrollHeight>n.clientHeight&&(i.push(n),r.push(n.scrollTop));while(n!=o);for(t.focus(),e=0;i.length>e;e++)i[e].scrollTop=r[e]}},load:function(e){this.clear(),this.setOptions(e),this._createShapes(),this._createConnections()},setOptions:function(e){B(this.options,e)},clear:function(){var e=this;e.select(!1),e.mainLayer.clear(),e._shapesQuadTree.clear(),e._initialize()},connect:function(e,t,n){var i,r;return this.connectionsDataSource&&this._isEditable?(r=this.connectionsDataSource.add({}),i=this._connectionsDataMap[r.uid],i.source(e),i.target(t),i.redraw(n),i.updateModel()):(i=new y(e,t,B({},this.options.connectionDefaults,n)),this.addConnection(i)),i},connected:function(e,t){var n,i;for(n=0;this.connections.length>n;n++)if(i=this.connections[n],i.from==e&&i.to==t)return!0;return!1},addConnection:function(e,t){return t!==!1&&this.undoRedoService.add(new M.AddConnectionUnit(e,this),!1),e.diagram=this,e._setOptionsFromModel(),e.refresh(),this.mainLayer.append(e.visual),this.connections.push(e),this.trigger(ke,{added:[e],removed:[]}),e},_addConnection:function(e,t){var n,i=this.connectionsDataSource;if(i&&this._isEditable){if(n=f(i,u(e.dataItem)),e.dataItem=n,e.updateModel(),!this.trigger("add",{connection:e}))return this._connectionsDataMap[n.uid]=e,i.add(n),this.addConnection(e,t),e._updateConnectors(),e}else if(!this.trigger("add",{connection:e}))return this.addConnection(e,t),e._updateConnectors(),e},addShape:function(e,t){var n,i=this.options.shapeDefaults;if(e instanceof w)n=e;else{if(e instanceof kendo.Class)return;i=B({},i,e||{}),n=new w(i,this)}return t!==!1&&this.undoRedoService.add(new M.AddShapeUnit(n,this),!1),this.shapes.push(n),n.diagram!==this&&(this._shapesQuadTree.insert(n),n.diagram=this),this.mainLayer.append(n.visual),this.trigger(ke,{added:[n],removed:[]}),n},_addShape:function(e,t){var n,i,r=this,o=r.dataSource;if(o&&this._isEditable){if(n=f(o,u(e.dataItem)),e.dataItem=n,e.updateModel(),!this.trigger("add",{shape:e}))return this.dataSource.add(n),i=this._inactiveShapeItems.getByUid(n.uid),i.element=e,i.undoable=t,e}else if(!this.trigger("add",{shape:e}))return this.addShape(e,t)},remove:function(e,t){var n,i,r,o;for(e=pe(e)?e.slice(0):[e],n=h(e),i=n.shapes,r=n.connections,fe(t)||(t=!0),t&&this.undoRedoService.begin(),this._suspendModelRefresh(),o=i.length-1;o>=0;o--)this._removeItem(i[o],t,r);for(o=r.length-1;o>=0;o--)this._removeItem(r[o],t);this._resumeModelRefresh(),t&&this.undoRedoService.commit(!1),this.trigger(ke,{added:[],removed:e})},_removeShapeDataItem:function(e){this._isEditable&&(this.dataSource.remove(e.dataItem),delete this._dataMap[e.dataItem.id])},_removeConnectionDataItem:function(e){this._isEditable&&(this.connectionsDataSource.remove(e.dataItem),delete this._connectionsDataMap[e.dataItem.uid])},_triggerRemove:function(e){var t,n,i,r,o=[];for(r=0;e.length>r;r++)t=e[r],i=t.options.editable,n=t instanceof w?{shape:t}:{connection:t},i&&i.remove!==!1&&!this.trigger("remove",n)&&o.push(t);return o},undo:function(){this.undoRedoService.undo()},redo:function(){this.undoRedoService.redo()},select:function(e,t){if(!he(e))return this._selectedItems;t=B({addToSelection:!1},t);var n,i,r=t.addToSelection,o=[],a=[];for(r||this.deselect(),this._internalSelection=!0,e instanceof Array?o=e:e instanceof _&&(o=[e]),n=0;o.length>n;n++)i=o[n],i.select(!0)&&a.push(i);this._selectionChanged(a,[]),this._internalSelection=!1},selectAll:function(){this.select(this.shapes.concat(this.connections))},selectArea:function(e){var t,n,i,r;if(this._internalSelection=!0,r=[],e instanceof j)for(n=this.shapes.concat(this.connections),t=0;n.length>t;t++)i=n[t],e&&!i._hitTest(e)||!i.options.enable||i.select(!0)&&r.push(i);this._selectionChanged(r,[]),this._internalSelection=!1},deselect:function(e){this._internalSelection=!0;var t,n,i=[],r=[];for(e instanceof Array?r=e:e instanceof _?r.push(e):he(e)||(r=this._selectedItems.slice(0)),n=0;r.length>n;n++)t=r[n],t.select(!1)&&i.push(t);this._selectionChanged([],i),this._internalSelection=!1},toFront:function(e,t){var n,i,r;e||(e=this._selectedItems.slice()),n=this._getDiagramItems(e),!fe(t)||t?(i=o(this.mainLayer,n.visuals),r=new le(this,e,i),this.undoRedoService.add(r)):(this.mainLayer.toFront(n.visuals),this._fixOrdering(n,!0))},toBack:function(e,t){var n,i,r;e||(e=this._selectedItems.slice()),n=this._getDiagramItems(e),!fe(t)||t?(i=o(this.mainLayer,n.visuals),r=new se(this,e,i),this.undoRedoService.add(r)):(this.mainLayer.toBack(n.visuals),this._fixOrdering(n,!1))},bringIntoView:function(e,t){var n,i,r,o,a=this.viewport(),s=new M.RectAlign(a);0!==a.width&&0!==a.height&&(t=B({animate:!1,align:"center middle"},t),"none"==t.align&&(t.align="center middle"),e instanceof _?i=e.bounds(et):pe(e)?i=this.boundingBox(e):e instanceof j&&(i=e.clone()),r=i.clone(),i.zoom(this._zoom),(i.width>a.width||i.height>a.height)&&(this._zoom=this._getValidZoom(_e.min(a.width/r.width,a.height/r.height)),i=r.clone().zoom(this._zoom)),this._zoomMainLayer(),n=i.clone(),s.align(i,t.align),o=i.topLeft().minus(n.topLeft()),this.pan(o.times(-1),t.animate))},alignShapes:function(e){var t,n,i,r,o,a,s;if(ue(e)&&(e="Left"),t=this.select(),0!==t.length){switch(e.toLowerCase()){case"left":case"top":n=Xe;break;case"right":case"bottom":n=Je}for(r=0;t.length>r;r++)if(i=t[r],i instanceof w)switch(e.toLowerCase()){case"left":n=_e.min(n,i.options.x);break;case"top":n=_e.min(n,i.options.y);break;case"right":n=_e.max(n,i.options.x);break;case"bottom":n=_e.max(n,i.options.y)}for(o=[],a=[],r=0;t.length>r;r++)if(i=t[r],i instanceof w)switch(a.push(i),o.push(i.bounds()),e.toLowerCase()){case"left":case"right":i.position(new Q(n,i.options.y));break;case"top":case"bottom":i.position(new Q(i.options.x,n))}s=new M.TransformUnit(a,o),this.undoRedoService.add(s,!1)}},zoom:function(e,t){var n,i,r,o;return e&&(n=t?t.point:new M.Point(0,0),e=this._zoom=this._getValidZoom(e),ue(n)||(n=new M.Point(_e.round(n.x),_e.round(n.y)),i=n.times(e),r=this.modelToView(n),o=r.minus(i),this._storePan(new M.Point(_e.round(o.x),_e.round(o.y)))),t&&(t.zoom=e),this._panTransform(),this._updateAdorners()),this._zoom},_getPan:function(e){var t=this.canvas;return t.translate||(e=e.plus(this._pan)),e},pan:function(e,t){var n,i;e instanceof Q&&(n=this,i=n.scroller,e=n._getPan(e),e=e.times(-1),t?i.animatedScrollTo(e.x,e.y,function(){n._updateAdorners()}):(i.scrollTo(e.x,e.y),n._updateAdorners()))},viewport:function(){var e=this.element,t=e.width(),n=e.height();return this.toolBar&&(n-=this.toolBar.element.outerHeight()),new j(0,0,t,n)},copy:function(){var e,t;if(this.options.copy.enabled)for(this._clipboard=[],this._copyOffset=1,e=0;this._selectedItems.length>e;e++)t=this._selectedItems[e],this._clipboard.push(t)},cut:function(){var e,t;if(this.options.copy.enabled){for(this._clipboard=[],this._copyOffset=0,e=0;this._selectedItems.length>e;e++)t=this._selectedItems[e],this._clipboard.push(t);this.remove(this._clipboard,!0)}},paste:function(){var e,t,n,i,r,o,a,s;if(this._clipboard.length>0){for(i={},r=h(this._clipboard),o=r.connections,a=r.shapes,s={x:this._copyOffset*this.options.copy.offsetX,y:this._copyOffset*this.options.copy.offsetY},this.deselect(),n=0;a.length>n;n++)e=a[n],t=e.clone(),i[e.id]=t,t.position(new Q(e.options.x+s.x,e.options.y+s.y)),t.diagram=this,t=this._addShape(t),t&&t.select();for(n=0;o.length>n;n++)e=o[n],t=this._addConnection(e.clone()),t&&(this._updateCopiedConnection(t,e,"source",i,s),this._updateCopiedConnection(t,e,"target",i,s),t.select(!0),t.updateModel());this._syncChanges(),this._copyOffset+=1}},_updateCopiedConnection:function(e,t,n,i,r){var o,a,s,l=t[n](),c=this;l instanceof b&&i[l.shape.id]?(s=i[l.shape.id],c.getShapeById(s.id)?e[n](s.getConnector(l.options.name)):(a=c._inactiveShapeItems.getByUid(s.dataItem.uid),a&&(o=function(t){s=c._dataMap[t.id],e[n](s.getConnector(l.options.name)),e.updateModel()},c._deferredConnectionUpdates.push(a.onActivate(o))))):e[n](new Q(t[n+"Point"]().x+r.x,t[n+"Point"]().y+r.y))},boundingBox:function(e,t){var n,i,r,o=j.empty(),a=he(e)?this._getDiagramItems(e):{shapes:this.shapes};if(a.shapes.length>0)for(i=a.shapes[0],o=i.bounds(tt),r=1;a.shapes.length>r;r++)i=a.shapes[r],n=i.bounds(tt),t===!0&&(n.x-=i._rotationOffset.x,n.y-=i._rotationOffset.y),o=o.union(n);return o},_containerOffset:function(){var e=this.element.offset();return this.toolBar&&(e.top+=this.toolBar.element.outerHeight()),e},documentToView:function(e){var t=this._containerOffset();return new Q(e.x-t.left,e.y-t.top)},viewToDocument:function(e){var t=this._containerOffset();return new Q(e.x+t.left,e.y+t.top)},viewToModel:function(e){return this._transformWithMatrix(e,this._matrixInvert)},modelToView:function(e){return this._transformWithMatrix(e,this._matrix)},modelToLayer:function(e){return this._transformWithMatrix(e,this._layerMatrix)},layerToModel:function(e){return this._transformWithMatrix(e,this._layerMatrixInvert)},documentToModel:function(e){var t=this.documentToView(e);return this.canvas.translate||(t.x=t.x+this.scroller.scrollLeft,t.y=t.y+this.scroller.scrollTop),this.viewToModel(t)},modelToDocument:function(e){return this.viewToDocument(this.modelToView(e))},_transformWithMatrix:function(e,t){var n,i,r=e;return e instanceof Q?t&&(r=t.apply(e)):(n=this._transformWithMatrix(e.topLeft(),t),i=this._transformWithMatrix(e.bottomRight(),t),r=j.fromPoints(n,i)),r},setDataSource:function(e){this.options.dataSource=e,this._dataSource(),this.options.autoBind&&this.dataSource.fetch()},setConnectionsDataSource:function(e){this.options.connectionsDataSource=e,this._connectionDataSource(),this.options.autoBind&&this.connectionsDataSource.fetch()},layout:function(e){var t,n,i,r,o;switch(this._layouting=!0,ue(e)&&(e=this.options.layout),t=ue(e)||ue(e.type)?"Tree":e.type,t.toLowerCase()){case"tree":n=new M.TreeLayout(this);break;case"layered":n=new M.LayeredLayout(this);break;case"forcedirected":case"force":case"spring":case"springembedder":n=new M.SpringLayout(this);break;default:throw"Layout algorithm '"+t+"' is not supported."}i=new M.LayoutState(this),r=n.layout(e),r&&(o=new M.LayoutUndoUnit(i,r,e?e.animate:null),this.undoRedoService.add(o)),this._layouting=!1,this._redrawConnections()},getShapeById:function(e){var t;return(t=oe.first(this.shapes,function(t){return t.visual.id===e}))?t:t=oe.first(this.connections,function(t){return t.visual.id===e})},_extendLayoutOptions:function(e){e.layout&&(e.layout=B(M.LayoutBase.fn.defaultOptions||{},e.layout))},_selectionChanged:function(e,t){(e.length||t.length)&&this.trigger(Be,{selected:e,deselected:t})},_getValidZoom:function(e){return _e.min(_e.max(e,this.options.zoomMin),this.options.zoomMax)},_panTransform:function(e){var t=this,n=e||t._pan;t.canvas.translate?(t.scroller.scrollTo(n.x,n.y),t._zoomMainLayer()):(t._storePan(n),t._transformMainLayer())},_finishPan:function(){this.trigger(He,{total:this._pan,delta:Number.NaN})},_storePan:function(e){this._pan=e,this._storeViewMatrix()},_zoomMainLayer:function(){var e=this._zoom,t=new W(0,0,e,e);t.render(this.mainLayer),this._storeLayerMatrix(t),this._storeViewMatrix()},_transformMainLayer:function(){var e=this._pan,t=this._zoom,n=new W(e.x,e.y,t,t);n.render(this.mainLayer),this._storeLayerMatrix(n),this._storeViewMatrix()},_storeLayerMatrix:function(e){this._layerMatrix=e.toMatrix(),this._layerMatrixInvert=e.invert().toMatrix()},_storeViewMatrix:function(){var e=this._pan,t=this._zoom,n=new W(e.x,e.y,t,t);this._matrix=n.toMatrix(),this._matrixInvert=n.invert().toMatrix()},_toIndex:function(e,t){var n=this._getDiagramItems(e);this.mainLayer.toIndex(n.visuals,t),this._fixOrdering(n,!1)},_fixOrdering:function(e,t){var n,i,r=t?this.shapes.length-1:0,o=t?this.connections.length-1:0;for(n=0;e.shapes.length>n;n++)i=e.shapes[n],oe.remove(this.shapes,i),oe.insert(this.shapes,i,r);for(n=0;e.cons.length>n;n++)i=e.cons[n],oe.remove(this.connections,i),oe.insert(this.connections,i,o)},_getDiagramItems:function(e){var t,n,i={},r=e;for(i.visuals=[],i.shapes=[],i.cons=[],e?pe(e)||(r=[e]):r=this._selectedItems.slice(),t=0;r.length>t;t++)n=r[t],n instanceof w?(i.shapes.push(n),i.visuals.push(n.visual)):n instanceof y&&(i.cons.push(n),i.visuals.push(n.visual));return i},_removeItem:function(e,t,n){e.select(!1),e instanceof w?(this._removeShapeDataItem(e),this._removeShape(e,t,n)):e instanceof y&&(this._removeConnectionDataItem(e),this._removeConnection(e,t)),this.mainLayer.remove(e.visual)},_removeShape:function(e,t,n){var i,r,o,a,s=[],l=[];for(this.toolService._removeHover(),t&&this.undoRedoService.addCompositeItem(new G(e)),oe.remove(this.shapes,e),this._shapesQuadTree.remove(e),i=0;e.connectors.length>i;i++)for(o=e.connectors[i],a=0;o.connections.length>a;a++)r=o.connections[a],n&&E.inArray(r,n)||(r.sourceConnector==o?s.push(r):r.targetConnector==o&&l.push(r));for(i=0;s.length>i;i++)s[i].source(null,t),s[i].updateModel();for(i=0;l.length>i;i++)l[i].target(null,t),l[i].updateModel()},_removeConnection:function(e,t){e.sourceConnector&&oe.remove(e.sourceConnector.connections,e),e.targetConnector&&oe.remove(e.targetConnector.connections,e),t&&this.undoRedoService.addCompositeItem(new $(e)),oe.remove(this.connections,e)},_removeDataItems:function(e,t){var n,i,r,o;for(e=pe(e)?e:[e];e.length;)if(n=e.shift(),r=this._dataMap[n.uid],r&&(this._removeShapeConnections(r),this._removeItem(r,!1),delete this._dataMap[n.uid],t&&n.hasChildren&&n.loaded()))for(i=n.children.data(),o=0;i.length>o;o++)e.push(i[o])},_removeShapeConnections:function(e){var t,n=e.connections();if(n)for(t=0;n.length>t;t++)this._removeItem(n[t],!1)},_addDataItem:function(e,t){var n,i;if(fe(e))return(n=this._dataMap[e.id])?n:(i=B({},this.options.shapeDefaults),i.dataItem=e,n=new w(i,this),this.addShape(n,t!==!1),this._dataMap[e.id]=n,n)},_addDataItemByUid:function(e){var t,n;if(fe(e))return(t=this._dataMap[e.uid])?t:(n=B({},this.options.shapeDefaults),n.dataItem=e,t=new w(n,this),this.addShape(t),this._dataMap[e.uid]=t,t)},_addDataItems:function(e,t){var n,i,r,o,a;for(i=0;e.length>i;i++)n=e[i],r=this._addDataItemByUid(n),o=this._addDataItemByUid(t),o&&!this.connected(o,r)&&(a=this.connect(o,r))},_refreshSource:function(e){var t,n,i=this,r=e.node,o=e.action,a=e.items,s=i.options;if(!e.field){if("remove"==o)this._removeDataItems(e.items,!0);else for(o&&"itemloaded"!==o||this._bindingRoots||(this._bindingRoots=!0,n=!0),o||r||i.clear(),this._addDataItems(a,r),t=0;a.length>t;t++)a[t].load();s.layout&&(n||"remove"==o||"add"==o)&&i.layout(s.layout),n&&(this.trigger("dataBound"),this._bindingRoots=!1)}},_mouseDown:function(e){var t=this._calculatePosition(e);1==e.which&&this.toolService.start(t,this._meta(e))&&(this._destroyToolBar(),e.preventDefault())},_addItem:function(e){e instanceof w?this.addShape(e):e instanceof y&&this.addConnection(e)},_mouseUp:function(e){var t=this._calculatePosition(e);1==e.which&&this.toolService.end(t,this._meta(e))&&(this._createToolBar(),e.preventDefault())},_createToolBar:function(){var e,t,n,i,r,o,a,s,l,c=this.toolService.diagram;this.singleToolBar||1!==c.select().length||(e=c.select()[0],e&&e.options.editable!==!1&&(t=e.options.editable,n=t.tools,this._isEditable&&0===n.length&&(e instanceof w?n=["edit","rotateClockwise","rotateAnticlockwise"]:e instanceof y&&(n=["edit"]),t&&t.remove!==!1&&n.push("delete")),n&&n.length&&(i=20,this.singleToolBar=new x(c,{tools:n,click:z(this._toolBarClick,this),modal:!0}),o=this.singleToolBar._popup.element.outerWidth(),a=this.singleToolBar._popup.element.outerHeight(),e instanceof w?(s=this.modelToView(e.bounds(tt)),r=Q(s.x,s.y).minus(Q((o-s.width)/2,a+i))):e instanceof y&&(l=this.modelToView(e.bounds()),r=Q(l.x,l.y).minus(Q((o-l.width-20)/2,a+i))),r?(this.canvas.translate||(r=r.minus(Q(this.scroller.scrollLeft,this.scroller.scrollTop))),r=this.viewToDocument(r),r=Q(_e.max(r.x,0),_e.max(r.y,0)),this.singleToolBar.showAt(r)):this._destroyToolBar())))},_toolBarClick:function(e){this.trigger("toolBarClick",e),this._destroyToolBar()},_mouseMove:function(e){if(!this.pauseMouseHandlers){var t=this._calculatePosition(e);0!==e.which&&1!=e.which||!this.toolService.move(t,this._meta(e))||e.preventDefault()}},_keydown:function(e){this.toolService.keyDown(e.keyCode,this._meta(e))&&e.preventDefault()},_wheel:function(e){var t=n(e),i=this._calculatePosition(e),r=B(this._meta(e),{delta:t});this.toolService.wheel(i,r)&&e.preventDefault()},_meta:function(e){return{ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}},_calculatePosition:function(e){var n=e.pageX===t?e.originalEvent:e,i=new Q(n.pageX,n.pageY),r=this.documentToModel(i);return r},_normalizePointZoom:function(e){return e.times(1/this.zoom())},_initialize:function(){this.shapes=[],this._selectedItems=[],this.connections=[],this._dataMap={},this._connectionsDataMap={},this._inactiveShapeItems=new d,this._deferredConnectionUpdates=[],this.undoRedoService=new Z({undone:this._syncHandler,redone:this._syncHandler}),this.id=M.randomId()},_fetchFreshData:function(){var e=this;e._dataSource(),e._isEditable&&e._connectionDataSource(),e.options.autoBind&&(e._isEditable?(this._loadingShapes=!0,this._loadingConnections=!0,e.dataSource.fetch(),e.connectionsDataSource.fetch()):e.dataSource.fetch())},_dataSource:function(){var e,t;fe(this.options.connectionsDataSource)?(this._isEditable=!0,e=this.options.dataSource||{},t=pe(e)?{data:e}:e,this.dataSource&&this._shapesRefreshHandler?this.dataSource.unbind("change",this._shapesRefreshHandler).unbind("requestStart",this._shapesRequestStartHandler).unbind("error",this._shapesErrorHandler):(this._shapesRefreshHandler=z(this._refreshShapes,this),this._shapesRequestStartHandler=z(this._shapesRequestStart,this),this._shapesErrorHandler=z(this._error,this)),this.dataSource=kendo.data.DataSource.create(t).bind("change",this._shapesRefreshHandler).bind("requestStart",this._shapesRequestStartHandler).bind("error",this._shapesErrorHandler)):(this._treeDataSource(),this._isEditable=!1)},_connectionDataSource:function(){var e,t=this.options.connectionsDataSource;t&&(e=pe(t)?{data:t}:t,this.connectionsDataSource&&this._connectionsRefreshHandler?this.connectionsDataSource.unbind("change",this._connectionsRefreshHandler).unbind("requestStart",this._connectionsRequestStartHandler).unbind("error",this._connectionsErrorHandler):(this._connectionsRefreshHandler=z(this._refreshConnections,this),this._connectionsRequestStartHandler=z(this._connectionsRequestStart,this),this._connectionsErrorHandler=z(this._connectionsError,this)),this.connectionsDataSource=kendo.data.DataSource.create(e).bind("change",this._connectionsRefreshHandler).bind("requestStart",this._connectionsRequestStartHandler).bind("error",this._connectionsErrorHandler))},_shapesRequestStart:function(e){"read"==e.type&&(this._loadingShapes=!0)},_connectionsRequestStart:function(e){"read"==e.type&&(this._loadingConnections=!0)},_error:function(){this._loadingShapes=!1},_connectionsError:function(){this._loadingConnections=!1},_refreshShapes:function(e){"remove"===e.action?this._shouldRefresh()&&this._removeShapes(e.items):"itemchange"===e.action?this._shouldRefresh()&&this._updateShapes(e.items,e.field):"add"===e.action?this._inactiveShapeItems.add(e.items):"sync"===e.action?this._syncShapes(e.items):this.refresh()},_shouldRefresh:function(){return!this._suspended},_suspendModelRefresh:function(){this._suspended=(this._suspended||0)+1},_resumeModelRefresh:function(){this._suspended=_e.max((this._suspended||0)-1,0)},refresh:function(){this._loadingShapes=!1,this._loadingConnections||this._rebindShapesAndConnections()},_rebindShapesAndConnections:function(){this.clear(),this._addShapes(this.dataSource.view()),this.connectionsDataSource&&this._addConnections(this.connectionsDataSource.view(),!1),this.options.layout?this.layout(this.options.layout):this._redrawConnections(),this.trigger("dataBound")},refreshConnections:function(){this._loadingConnections=!1,this._loadingShapes||this._rebindShapesAndConnections()},_redrawConnections:function(){var e,t=this.connections;for(e=0;t.length>e;e++)t[e].refresh()},_removeShapes:function(e){var t,n,i=this._dataMap;for(n=0;e.length>n;n++)t=e[n],i[t.id]&&(this.remove(i[t.id],!1),i[t.id]=null)},_syncShapes:function(){var e=this,t=e._inactiveShapeItems;t.forEach(function(n){var i=n.dataItem,r=n.element;i.isNew()||(r?(r._setOptionsFromModel(),e.addShape(r,n.undoable),e._dataMap[i.id]=r):e._addDataItem(i),n.activate(),t.remove(i))})},_updateShapes:function(e,t){var n,i,r;for(n=0;e.length>n;n++)i=e[n],r=this._dataMap[i.id],r&&r.updateOptionsFromModel(i,t)},_addShapes:function(e){for(var t=0;e.length>t;t++)this._addDataItem(e[t],!1)},_refreshConnections:function(e){"remove"===e.action?this._shouldRefresh()&&this._removeConnections(e.items):"add"===e.action?this._addConnections(e.items):"sync"===e.action||("itemchange"===e.action?this._shouldRefresh()&&this._updateConnections(e.items):this.refreshConnections())},_removeConnections:function(e){for(var t=0;e.length>t;t++)this.remove(this._connectionsDataMap[e[t].uid],!1),this._connectionsDataMap[e[t].uid]=null},_updateConnections:function(e){var t,n,i;for(t=0;e.length>t;t++)n=e[t],i=this._connectionsDataMap[n.uid],i.updateOptionsFromModel(n)},_addConnections:function(e,t){var n,i,r=e.length;for(n=0;r>n;n++)i=e[n],this._addConnectionDataItem(i,t)},_addConnectionDataItem:function(e,t){var n,i,r,o;this._connectionsDataMap[e.uid]||(n=this._validateConnector(e.from),fe(n)&&null!==n||(n=new Q(e.fromX,e.fromY)),i=this._validateConnector(e.to),fe(i)&&null!==i||(i=new Q(e.toX,e.toY)),fe(n)&&fe(i)&&(r=B({},this.options.connectionDefaults),r.dataItem=e,o=new y(n,i,r),this._connectionsDataMap[e.uid]=o,this.addConnection(o,t)))},_validateConnector:function(e){var t;return fe(e)&&null!==e&&(t=this._dataMap[e]),t},_treeDataSource:function(){var e=this,t=e.options,n=t.dataSource;n=pe(n)?{data:n}:n,n.fields||(n.fields=[{field:"text"},{field:"url"},{field:"spriteCssClass"},{field:"imageUrl"}]),e.dataSource&&e._refreshHandler&&e._unbindDataSource(),e._refreshHandler=z(e._refreshSource,e),e._errorHandler=z(e._error,e),e.dataSource=H.create(n).bind(ke,e._refreshHandler).bind(Ee,e._errorHandler)},_unbindDataSource:function(){var e=this;e.dataSource.unbind(ke,e._refreshHandler).unbind(Ee,e._errorHandler)},_adorn:function(e,n){n!==t&&e&&(n?(this._adorners.push(e),this.adornerLayer.append(e.visual)):(oe.remove(this._adorners,e),this.adornerLayer.remove(e.visual)))},_showConnectors:function(e,t){t?this._connectorsAdorner.show(e):this._connectorsAdorner.destroy()},_updateAdorners:function(){var e,t,n=this._adorners;for(e=0;n.length>e;e++)t=n[e],t.refreshBounds&&t.refreshBounds(),t.refresh()},_refresh:function(){for(var e=0;this.connections.length>e;e++)this.connections[e].refresh()},_destroyToolBar:function(){this.singleToolBar&&(this.singleToolBar.hide(),this.singleToolBar.destroy(),this.singleToolBar=null)},_destroyGlobalToolBar:function(){this.toolBar&&(this.toolBar.hide(),this.toolBar.destroy(),this.toolBar=null)},exportDOMVisual:function(){var e=this.canvas._viewBox,t=I.transform().translate(-e.x,-e.y),n=new I.Rect([0,0],[e.width,e.height]),i=F.Path.fromRect(n),r=new F.Group({transform:t}),o=new F.Group({clip:i}),a=this.canvas.drawingElement.children[0];return o.append(r),
r.children.push(a),o},exportVisual:function(){var e=I.transform().scale(1/this._zoom),t=new F.Group({transform:e}),n=this.mainLayer.drawingElement;return t.children.push(n),t},_syncChanges:function(){this._syncShapeChanges(),this._syncConnectionChanges()},_syncShapeChanges:function(){this.dataSource&&this._isEditable&&this.dataSource.sync()},_syncConnectionChanges:function(){var t=this;t.connectionsDataSource&&t._isEditable&&(e.when.apply(e,t._deferredConnectionUpdates).then(function(){t.connectionsDataSource.sync()}),t.deferredConnectionUpdates=[])}}),E.ExportMixin.extend(k.fn,!0),kendo.PDFMixin&&kendo.PDFMixin.extend(k.fn),x=kendo.Observable.extend({init:function(e,t){kendo.Observable.fn.init.call(this),this.diagram=e,this.options=B({},this.options,t),this._tools=[],this.createToolBar(),this.createTools(),this.appendTools(),this.options.modal&&this.createPopup(),this.bind(this.events,t)},events:["click"],createPopup:function(){this.container=e("
").append(this.element),this._popup=this.container.kendoPopup({}).getKendoPopup()},appendTools:function(){var e,t;for(e=0;this._tools.length>e;e++)t=this._tools[e],(t.buttons&&t.buttons.length||!fe(t.buttons))&&this._toolBar.add(t)},createToolBar:function(){this.element=e("
"),this._toolBar=this.element.kendoToolBar({click:z(this.click,this),resizable:!1}).getKendoToolBar(),this.element.css("border","none")},createTools:function(){for(var e=0;this.options.tools.length>e;e++)this.createTool(this.options.tools[e])},createTool:function(e){ve(e)||(e={name:e});var t=e.name+"Tool";this[t]?this[t](e):this._tools.push(B({},e,{attributes:this._setAttributes({action:e.name})}))},showAt:function(e){this._popup&&this._popup.open(e.x,e.y)},hide:function(){this._popup&&this._popup.close()},newGroup:function(){return{type:"buttonGroup",buttons:[]}},editTool:function(){this._tools.push({spriteCssClass:"k-icon k-i-pencil",showText:"overflow",type:"button",text:"Edit",attributes:this._setAttributes({action:"edit"})})},deleteTool:function(){this._tools.push({spriteCssClass:"k-icon k-i-close",showText:"overflow",type:"button",text:"Delete",attributes:this._setAttributes({action:"delete"})})},rotateAnticlockwiseTool:function(e){this._appendGroup("rotate"),this._rotateGroup.buttons.push({spriteCssClass:"k-icon k-i-rotateccw",showText:"overflow",text:"RotateAnticlockwise",group:"rotate",attributes:this._setAttributes({action:"rotateAnticlockwise",step:e.step})})},rotateClockwiseTool:function(e){this._appendGroup("rotate"),this._rotateGroup.buttons.push({spriteCssClass:"k-icon k-i-rotatecw",attributes:this._setAttributes({action:"rotateClockwise",step:e.step}),showText:"overflow",text:"RotateClockwise",group:"rotate"})},createShapeTool:function(){this._appendGroup("create"),this._createGroup.buttons.push({spriteCssClass:"k-icon k-i-shape",showText:"overflow",text:"CreateShape",group:"create",attributes:this._setAttributes({action:"createShape"})})},createConnectionTool:function(){this._appendGroup("create"),this._createGroup.buttons.push({spriteCssClass:"k-icon k-i-connector",showText:"overflow",text:"CreateConnection",group:"create",attributes:this._setAttributes({action:"createConnection"})})},undoTool:function(){this._appendGroup("history"),this._historyGroup.buttons.push({spriteCssClass:"k-icon k-i-undo",showText:"overflow",text:"Undo",group:"history",attributes:this._setAttributes({action:"undo"})})},redoTool:function(){this._appendGroup("history"),this._historyGroup.buttons.push({spriteCssClass:"k-icon k-i-redo",showText:"overflow",text:"Redo",group:"history",attributes:this._setAttributes({action:"redo"})})},_appendGroup:function(e){var t="_"+e+"Group";this[t]||(this[t]=this.newGroup(),this._tools.push(this[t]))},_setAttributes:function(e){var t={};return e.action&&(t[kendo.attr("action")]=e.action),e.step&&(t[kendo.attr("step")]=e.step),t},_getAttributes:function(e){var t,n={},i=e.attr(kendo.attr("action"));return i&&(n.action=i),t=e.attr(kendo.attr("step")),t&&(n.step=t),n},click:function(t){var n=this._getAttributes(e(t.target)),i=n.action;i&&this[i]&&this[i](n),this.trigger("click",this.eventData(i,t.target))},eventData:function(e,t){var n,i,r=this.selectedElements(),o=r.length,a=[],s=[];for(i=0;o>i;i++)n=r[i],n instanceof w?a.push(n):s.push(n);return{shapes:a,connections:s,action:e,target:t}},"delete":function(){var e=this.diagram,t=e._triggerRemove(this.selectedElements());t.length&&(this.diagram.remove(t,!0),this.diagram._syncChanges())},edit:function(){this.diagram.edit(this.selectedElements()[0])},rotateClockwise:function(e){var t=parseFloat(e.step||90);this._rotate(t)},rotateAnticlockwise:function(e){var t=parseFloat(e.step||90);this._rotate(-t)},_rotate:function(e){var t=this.diagram._resizingAdorner;t.angle(t.angle()+e),t.rotate()},selectedElements:function(){return this.diagram.select()},createShape:function(){this.diagram.createShape()},createConnection:function(){this.diagram.createConnection()},undo:function(){this.diagram.undo()},redo:function(){this.diagram.redo()},destroy:function(){this.diagram=null,this.element=null,this.options=null,this._toolBar&&this._toolBar.destroy(),this._popup&&this._popup.destroy()}}),C=kendo.Observable.extend({init:function(e,t){kendo.Observable.fn.init.call(this),this.options=L(!0,{},this.options,t),this.element=e,this.model=this.options.model,this.fields=this._getFields(),this._initContainer(),this.createEditable()},options:{editors:{}},_initContainer:function(){this.wrapper=this.element},createEditable:function(){var e=this.options;this.editable=new kendo.ui.Editable(this.wrapper,{fields:this.fields,target:e.target,clearContainer:!1,model:this.model})},_isEditable:function(e){return this.model.editable&&this.model.editable(e)},_getFields:function(){var e,t,n,i=[],r=this.model.fields;for(e in r)t={},this._isEditable(e)&&(n=this.options.editors[e],n&&(t.editor=n),t.field=e,i.push(t));return i},end:function(){return this.editable.end()},destroy:function(){this.editable.destroy(),this.editable.element.find("["+kendo.attr("container-for")+"]").empty(),this.model=this.wrapper=this.element=this.columns=this.editable=null}}),S=C.extend({init:function(e,t){C.fn.init.call(this,e,t),this.bind(this.events,this.options),this.open()},events:["update","cancel"],options:{window:{modal:!0,resizable:!1,draggable:!0,title:"Edit",visible:!1}},_initContainer:function(){var t,n=this;this.wrapper=e('').attr(kendo.attr("uid"),this.model.uid),t="",this.options.template?(t+=this._renderTemplate(),this.fields=[]):t+=this._renderFields(),t+=this._renderButtons(),this.wrapper.append(e('
').append(t)),this.window=new kendo.ui.Window(this.wrapper.appendTo(this.element),this.options.window),this.window.bind("close",function(e){e.userTriggered&&(e.sender.element.focus(),n._cancelClick(e))}),this._attachButtonEvents()},_renderTemplate:function(){var e=this.options.template;return"string"==typeof e&&(e=window.unescape(e)),e=kendo.template(e)(this.model)},_renderFields:function(){var e,t,n="";for(e=0;this.fields.length>e;e++)t=this.fields[e],n+=''+(t.field||"")+"
",this._isEditable(t.field)&&(n+="
');return n},_renderButtons:function(){var e='';return e+=this._createButton("update"),e+=this._createButton("cancel"),e+="
"},_createButton:function(e){return kendo.template(dt)(v[e])},_attachButtonEvents:function(){this._cancelClickHandler=z(this._cancelClick,this),this.window.element.on(xe+be,"a.k-diagram-cancel",this._cancelClickHandler),this._updateClickHandler=z(this._updateClick,this),this.window.element.on(xe+be,"a.k-diagram-update",this._updateClickHandler)},_updateClick:function(e){e.preventDefault(),this.trigger("update")},_cancelClick:function(e){e.preventDefault(),this.trigger("cancel")},open:function(){this.window.center().open()},close:function(){this.window.bind("deactivate",z(this.destroy,this)).close()},destroy:function(){this.window.close().destroy(),this.window.element.off(xe+be,"a.k-diagram-cancel",this._cancelClickHandler),this.window.element.off(xe+be,"a.k-diagram-update",this._updateClickHandler),this._cancelClickHandler=null,this._editUpdateClickHandler=null,this.window=null,C.fn.destroy.call(this)}}),c.fn=c.prototype={onActivate:function(t){var n=e.Deferred();return this.callbacks.push({callback:t,deferred:n}),n},activate:function(){var e,t,n=this.callbacks;for(t=0;n.length>t;t++)e=this.callbacks[t],e.callback(this.dataItem),e.deferred.resolve();this.callbacks=[]}},d.fn=d.prototype={add:function(e){for(var t=0;e.length>t;t++)this.items[e[t].uid]=new c(e[t])},forEach:function(e){for(var t in this.items)e(this.items[t])},getByUid:function(e){return this.items[e]},remove:function(e){delete this.items[e.uid]}},T=P.extend({init:function(){this.shapes=[]},_add:function(e,t){this.shapes.push({bounds:t,shape:e}),e._quadNode=this},insert:function(e,t){this._add(e,t)},remove:function(e){var t,n=this.shapes,i=n.length;for(t=0;i>t;t++)if(n[t].shape===e){n.splice(t,1);break}},hitTestRect:function(e){var t,n=this.shapes,i=n.length;for(t=0;i>t;t++)if(this._testRect(n[t].shape,e))return!0},_testRect:function(e,t){var n,i=e.rotate().angle,r=e.bounds();return n=i?X.rects(t,r,-i):r.overlaps(t)}}),D=T.extend({init:function(e){T.fn.init.call(this),this.children=[],this.rect=e},inBounds:function(e){var t=this.rect,n=t.bottomRight(),i=e.bottomRight(),r=e.x>=t.x&&e.y>=t.y&&n.x>=i.x&&n.y>=i.y;return r},overlapsBounds:function(e){return this.rect.overlaps(e)},insert:function(e,t){var n,i=!1,r=this.children,o=r.length;if(this.inBounds(t)){if(!o&&4>this.shapes.length)this._add(e,t);else{for(o||this._initChildren(),n=0;r.length>n;n++)if(r[n].insert(e,t)){i=!0;break}i||this._add(e,t)}i=!0}return i},_initChildren:function(){var e,t,n=this.rect,i=this.children,r=this.shapes,o=n.center(),a=n.width/2,s=n.height/2;for(i.push(new D(new j(n.x,n.y,a,s)),new D(new j(o.x,n.y,a,s)),new D(new j(n.x,o.y,a,s)),new D(new j(o.x,o.y,a,s))),t=r.length-1;t>=0;t--)for(e=0;i.length>e;e++)if(i[e].insert(r[t].shape,r[t].bounds)){r.splice(t,1);break}},hitTestRect:function(e){var t,n=this.children,i=n.length,r=!1;if(this.overlapsBounds(e))if(T.fn.hitTestRect.call(this,e))r=!0;else for(t=0;i>t;t++)if(n[t].hitTestRect(e)){r=!0;break}return r}}),A=P.extend({ROOT_SIZE:1e3,init:function(e){var t=z(this._boundsChange,this);e.bind(ye,t),e.bind(Le,t),this.initRoots()},initRoots:function(){this.rootMap={},this.root=new T},clear:function(){this.initRoots()},_boundsChange:function(e){e.item._quadNode&&e.item._quadNode.remove(e.item),this.insert(e.item)},insert:function(e){var t=e.bounds(tt),n=this.ROOT_SIZE,i=this.getSectors(t),r=i[0][0],o=i[1][0];this.inRoot(i)?this.root.insert(e,t):(this.rootMap[r]||(this.rootMap[r]={}),this.rootMap[r][o]||(this.rootMap[r][o]=new D(new j(r*n,o*n,n,n))),this.rootMap[r][o].insert(e,t))},remove:function(e){e._quadNode&&e._quadNode.remove(e)},inRoot:function(e){return e[0].length>1||e[1].length>1},getSectors:function(e){var t,n,i=this.ROOT_SIZE,r=e.bottomRight(),o=_e.floor(r.x/i),a=_e.floor(r.y/i),s=[[],[]];for(t=_e.floor(e.x/i);o>=t;t++)s[0].push(t);for(n=_e.floor(e.y/i);a>=n;n++)s[1].push(n);return s},hitTestRect:function(e){var t,n,i,r,o,a=this.getSectors(e);if(this.root.hitTestRect(e))return!0;for(t=0;a[0].length>t;t++)for(i=a[0][t],n=0;a[1].length>n;n++)if(r=a[1][n],o=(this.rootMap[i]||{})[r],o&&o.hitTestRect(e))return!0;return!1}}),E.ui.plugin(k),B(M,{Shape:w,Connection:y,Connector:b,DiagramToolBar:x,QuadNode:D,QuadRoot:T,ShapesQuadTree:A,PopupEditor:S})}(window.kendo.jQuery)},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.dataviz.diagram.min",["kendo.data.min","kendo.draganddrop.min","kendo.userevents.min","kendo.mobile.scroller.min","kendo.drawing.min","dataviz/diagram/utils.min","dataviz/diagram/math.min","dataviz/diagram/svg.min","dataviz/diagram/services.min","dataviz/diagram/layout.min","dataviz/diagram/dom.min"],e)}(function(){},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.dataviz.treemap.min",["kendo.data.min","kendo.userevents.min","kendo.dataviz.themes.min"],e)}(function(){return function(e,t){function n(e,t){if(null===t)return t;var n=k(e,!0);return n(t)}function i(e){return typeof e!==I}function r(e,t,n){var i,r,l=s(e),c=s(t),d=u(e)-u(t)<0,h=[];for(h.push(e),i=0;n>i;i++)r={r:o(l.r,c.r,i,n,d),g:o(l.g,c.g,i,n,d),b:o(l.b,c.b,i,n,d)},h.push(a(r));return h.push(t),h}function o(e,t,n,i,r){var o,a=f.min(f.abs(e),f.abs(t)),s=f.max(f.abs(e),f.abs(t)),l=(s-a)/(i+1),c=l*(n+1);return o=r?a+c:s-c}function a(e){return"#"+l(e.r)+l(e.g)+l(e.b)}function s(e){e=e.replace("#","");var t=c(e);return{r:d(t.r),g:d(t.g),b:d(t.b)}}function l(e){var t=f.round(e).toString(16).toUpperCase();return 1===t.length&&(t="0"+t),t}function c(e){var t=e.length,n={};return 3===t?(n.r=e[0],n.g=e[1],n.b=e[2]):(n.r=e.substring(0,2),n.g=e.substring(2,4),n.b=e.substring(4,6)),n}function d(e){return parseInt(e.toString(16),16)}function u(e){var t=0;return e&&(e=s(e),t=f.sqrt(.241*e.r*e.r+.691*e.g*e.g+.068*e.b*e.b)),t}function h(e){var t=f.pow(10,4);return f.round(e*t)/t}var f=Math,p=e.proxy,m=e.isArray,g=window.kendo,v=g.Class,_=g.ui.Widget,b=g.template,w=g.deepExtend,y=g.data.HierarchicalDataSource,k=g.getter,x=g.dataviz,C=".kendoTreeMap",S="change",T="dataBound",D="itemCreated",A=Number.MAX_VALUE,E="mouseover"+C,F="mouseleave"+C,I="undefined",M=_.extend({init:function(t,n){g.destroy(t),e(t).empty(),_.fn.init.call(this,t,n),this.wrapper=this.element,this._initTheme(this.options),this.element.addClass("k-widget k-treemap"),this._setLayout(),this._originalOptions=w({},this.options),this._initDataSource(),this._attachEvents(),g.notify(this,x.ui)},options:{name:"TreeMap",theme:"default",autoBind:!0,textField:"text",valueField:"value",colorField:"color"},events:[T,D],_initTheme:function(e){var t=this,n=x.ui.themes||{},i=((e||{}).theme||"").toLowerCase(),r=(n[i]||{}).treeMap;t.options=w({},r,e)},_attachEvents:function(){this.element.on(E,p(this._mouseover,this)).on(F,p(this._mouseleave,this)),this._resizeHandler=p(this.resize,this,!1),g.onResize(this._resizeHandler)},_setLayout:function(){"horizontal"===this.options.type?(this._layout=new z(!1),this._view=new B(this,this.options)):"vertical"===this.options.type?(this._layout=new z(!0),this._view=new B(this,this.options)):(this._layout=new R,this._view=new P(this,this.options))},_initDataSource:function(){var e=this,t=e.options,n=t.dataSource;e._dataChangeHandler=p(e._onDataChange,e),e.dataSource=y.create(n).bind(S,e._dataChangeHandler),n&&e.options.autoBind&&e.dataSource.fetch()},setDataSource:function(e){var t=this;t.dataSource.unbind(S,t._dataChangeHandler),t.dataSource=e.bind(S,t._dataChangeHandler),e&&t.options.autoBind&&t.dataSource.fetch()},_onDataChange:function(e){var t,n,i,r,o=e.node,a=e.items,s=this.options;if(o){if(a.length){for(i=this._getByUid(o.uid),i.children=[],a=new g.data.Query(a)._sortForGrouping(s.valueField,"desc"),n=0;a.length>n;n++)t=a[n],i.children.push(this._wrapItem(t));r=this._view.htmlSize(i),this._layout.compute(i.children,i.coord,r),this._setColors(i.children),this._view.render(i)}}else this._cleanItems(),this.element.empty(),t=this._wrapItem(a[0]),this._layout.createRoot(t,this.element.outerWidth(),this.element.outerHeight(),"vertical"===this.options.type),this._view.createRoot(t),this._root=t,this._colorIdx=0;for(n=0;a.length>n;n++)a[n].load();o&&this.trigger(T,{node:o})},_cleanItems:function(){var e=this;e.angular("cleanup",function(){return{elements:e.element.find(".k-leaf div,.k-treemap-title,.k-treemap-title-vertical")}})},_setColors:function(e){var t,n,o,a,s=this.options.colors,l=this._colorIdx,c=s[l%s.length];for(m(c)&&(t=r(c[0],c[1],e.length)),o=!1,a=0;e.length>a;a++)n=e[a],i(n.color)||(n.color=t?t[a]:c),n.dataItem.hasChildren||(o=!0);o&&this._colorIdx++},_contentSize:function(e){this.view.renderHeight(e)},_wrapItem:function(e){var t={};return i(this.options.valueField)&&(t.value=n(this.options.valueField,e)),i(this.options.colorField)&&(t.color=n(this.options.colorField,e)),i(this.options.textField)&&(t.text=n(this.options.textField,e)),t.level=e.level(),t.dataItem=e,t},_getByUid:function(e){for(var t,n=[this._root];n.length;){if(t=n.pop(),t.dataItem.uid===e)return t;t.children&&(n=n.concat(t.children))}},dataItem:function(t){var n=e(t).attr(g.attr("uid")),i=this.dataSource;return i&&i.getByUid(n)},findByUid:function(e){return this.element.find(".k-treemap-tile["+g.attr("uid")+"='"+e+"']")},_mouseover:function(t){var n=e(t.target);n.hasClass("k-leaf")&&(this._removeActiveState(),n.removeClass("k-state-hover").addClass("k-state-hover"))},_removeActiveState:function(){this.element.find(".k-state-hover").removeClass("k-state-hover")},_mouseleave:function(){this._removeActiveState()},destroy:function(){_.fn.destroy.call(this),this.element.off(C),this.dataSource&&this.dataSource.unbind(S,this._dataChangeHandler),this._root=null,g.unbindResize(this._resizeHandler),g.destroy(this.element)},items:function(){return e()},getSize:function(){return g.dimensions(this.element)},_resize:function(){var e,t,n=this._root;n&&(e=this.element,t=e.children(),n.coord.width=e.outerWidth(),n.coord.height=e.outerHeight(),t.css({width:n.coord.width,height:n.coord.height}),this._resizeItems(n,t))},_resizeItems:function(e,t){var n,i,r,o;if(e.children&&e.children.length)for(n=t.children(".k-treemap-wrap").children(),this._layout.compute(e.children,e.coord,{text:this._view.titleSize(e,t)}),o=0;e.children.length>o;o++)i=e.children[o],r=n.filter("["+g.attr("uid")+"='"+i.dataItem.uid+"']"),this._view.setItemSize(i,r),this._resizeItems(i,r)},setOptions:function(e){var n=e.dataSource;e.dataSource=t,this._originalOptions=w(this._originalOptions,e),this.options=w({},this._originalOptions),this._setLayout(),this._initTheme(this.options),_.fn._setEvents.call(this,e),n&&this.setDataSource(y.create(n)),this.options.autoBind&&this.dataSource.fetch()}}),R=v.extend({createRoot:function(e,t,n){e.coord={width:t,height:n,top:0,left:0}},leaf:function(e){return!e.children},layoutChildren:function(e,t){var n,i,r,o,a=t.width*t.height,s=0,l=[];for(n=0;e.length>n;n++)l[n]=parseFloat(e[n].value),s+=l[n];for(n=0;l.length>n;n++)e[n].area=a*l[n]/s;i=this.layoutHorizontal()?t.height:t.width,r=[e[0]],o=e.slice(1),this.squarify(o,r,i,t)},squarify:function(e,t,n,i){this.computeDim(e,t,n,i)},computeDim:function(e,n,i,r){var o,a,s;return e.length+n.length==1?(o=1==e.length?e:n,this.layoutLast(o,i,r),t):(e.length>=2&&0===n.length&&(n=[e[0]],e=e.slice(1)),0===e.length?(n.length>0&&this.layoutRow(n,i,r),t):(a=e[0],this.worstAspectRatio(n,i)>=this.worstAspectRatio([a].concat(n),i)?this.computeDim(e.slice(1),n.concat([a]),i,r):(s=this.layoutRow(n,i,r),this.computeDim(e,[],s.dim,s)),t))},layoutLast:function(e,t,n){e[0].coord=n},layoutRow:function(e,t,n){return this.layoutHorizontal()?this.layoutV(e,t,n):this.layoutH(e,t,n)},orientation:"h",layoutVertical:function(){return"v"===this.orientation},layoutHorizontal:function(){return"h"===this.orientation},layoutChange:function(){this.orientation=this.layoutVertical()?"h":"v"},worstAspectRatio:function(e,t){var n,i,r,o,a;if(!e||0===e.length)return A;for(n=0,i=0,r=A,o=0;e.length>o;o++)a=e[o].area,n+=a,r=a>r?r:a,i=i>a?i:a;return f.max(t*t*i/(n*n),n*n/(t*t*r))},compute:function(e,t,n){if(t.width>=t.height&&this.layoutHorizontal()||this.layoutChange(),e&&e.length>0){var i={width:t.width,height:t.height-n.text,top:0,left:0};this.layoutChildren(e,i)}},layoutV:function(e,t,n){var i,r,o,a=this._totalArea(e),s=0;for(t=h(a/t),i=0;e.length>i;i++)r=h(e[i].area/t),e[i].coord={height:r,width:t,top:n.top+s,left:n.left},s+=r;return o={height:n.height,width:n.width-t,top:n.top,left:n.left+t},o.dim=f.min(o.width,o.height),o.dim!=o.height&&this.layoutChange(),o},layoutH:function(e,t,n){var i,r,o=this._totalArea(e),a=h(o/t),s=n.top,l=0;for(i=0;e.length>i;i++)e[i].coord={height:a,width:h(e[i].area/a),top:s,left:n.left+l},l+=e[i].coord.width;return r={height:n.height-a,width:n.width,top:n.top+a,left:n.left},r.dim=f.min(r.width,r.height),r.dim!=r.width&&this.layoutChange(),r},_totalArea:function(e){var t,n=0;for(t=0;e.length>t;t++)n+=e[t].area;return n}}),P=v.extend({init:function(t,n){this.options=w({},this.options,n),this.treeMap=t,this.element=e(t.element),this.offset=0},titleSize:function(e,t){var n=t.children(".k-treemap-title");return n.height()},htmlSize:function(e){var t,n,i=this._getByUid(e.dataItem.uid),r={text:0};return e.children&&(this._clean(i),t=this._getText(e),t&&(n=this._createTitle(e),i.append(n),this._compile(n,e.dataItem),r.text=n.height()),i.append(this._createWrap()),this.offset=(i.outerWidth()-i.innerWidth())/2),r},_compile:function(e,t){this.treeMap.angular("compile",function(){return{elements:e,data:[{dataItem:t}]}})},_getByUid:function(e){return this.element.find(".k-treemap-tile["+g.attr("uid")+"='"+e+"']")},render:function(e){var t,n,i,r,o=this._getByUid(e.dataItem.uid),a=e.children;if(a)for(t=o.find(".k-treemap-wrap"),n=0;a.length>n;n++)i=a[n],r=this._createLeaf(i),t.append(r),this._compile(r.children(),i.dataItem),this.treeMap.trigger(D,{element:r})},createRoot:function(e){var t=this._createLeaf(e);this.element.append(t),this._compile(t.children(),e.dataItem),this.treeMap.trigger(D,{element:t})},_clean:function(e){this.treeMap.angular("cleanup",function(){return{elements:e.children(":not(.k-treemap-wrap)")}}),e.css("background-color",""),e.removeClass("k-leaf"),e.removeClass("k-inverse"),e.empty()},_createLeaf:function(t){return this._createTile(t).css("background-color",t.color).addClass("k-leaf").toggleClass("k-inverse",this._tileColorBrightness(t)>180).append(e("
").html(this._getText(t)))},_createTile:function(t){var n=e("
");return this.setItemSize(t,n),i(t.dataItem)&&i(t.dataItem.uid)&&n.attr(g.attr("uid"),t.dataItem.uid),n},_itemCoordinates:function(e){var t={width:e.coord.width,height:e.coord.height,left:e.coord.left,top:e.coord.top};return t.width+=t.left&&this.offset?2*this.offset:this.offset,t.height+=t.top?2*this.offset:this.offset,t},setItemSize:function(e,t){var n=this._itemCoordinates(e);t.css({width:n.width,height:n.height,left:n.left,top:n.top})},_getText:function(e){var t=e.text;return this.options.template&&(t=this._renderTemplate(e)),t},_renderTemplate:function(e){var t=b(this.options.template);return t({dataItem:e.dataItem,text:e.text})},_createTitle:function(t){return e("
").append(e("
").html(this._getText(t)))},_createWrap:function(){return e("
")},_tileColorBrightness:function(e){return u(e.color)}}),z=v.extend({createRoot:function(e,t,n,i){e.coord={width:t,height:n,top:0,left:0},e.vertical=i},init:function(e){this.vertical=e,this.quotient=e?1:0},compute:function(e,t,n){var i,r,o;e.length>0&&(i=t.width,r=t.height,this.vertical?r-=n.text:i-=n.text,o={width:i,height:r,top:0,left:0},this.layoutChildren(e,o))},layoutChildren:function(e,t){var n,i,r=t.width*t.height,o=0,a=[];for(n=0;e.length>n;n++)i=e[n],a[n]=parseFloat(e[n].value),o+=a[n],i.vertical=this.vertical;for(n=0;a.length>n;n++)e[n].area=r*a[n]/o;this.sliceAndDice(e,t)},sliceAndDice:function(e,t){var n=this._totalArea(e);e[0].level%2===this.quotient?this.layoutHorizontal(e,t,n):this.layoutVertical(e,t,n)},layoutHorizontal:function(e,t,n){var i,r,o,a=0;for(i=0;e.length>i;i++)r=e[i],o=r.area/(n/t.width),r.coord={height:t.height,width:o,top:t.top,left:t.left+a},a+=o},layoutVertical:function(e,t,n){var i,r,o,a=0;for(i=0;e.length>i;i++)r=e[i],o=r.area/(n/t.height),r.coord={height:o,width:t.width,top:t.top+a,left:t.left},a+=o},_totalArea:function(e){var t,n=0;for(t=0;e.length>t;t++)n+=e[t].area;return n}}),B=P.extend({htmlSize:function(e){var t,n,i=this._getByUid(e.dataItem.uid),r={text:0,offset:0};return e.children&&(this._clean(i),t=this._getText(e),t&&(n=this._createTitle(e),i.append(n),this._compile(n,e.dataItem),r.text=e.vertical?n.height():n.width()),i.append(this._createWrap()),this.offset=(i.outerWidth()-i.innerWidth())/2),r},titleSize:function(e,t){var n;return n=e.vertical?t.children(".k-treemap-title").height():t.children(".k-treemap-title-vertical").width()},_createTitle:function(t){var n;return n=e(t.vertical?"
":"
"),n.append(e("
").html(this._getText(t)))}});x.ui.plugin(M)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.dataviz.min",["kendo.core.min","kendo.fx.min","kendo.router.min","kendo.view.min","kendo.data.odata.min","kendo.data.xml.min","kendo.data.min","kendo.data.signalr.min","kendo.binder.min","kendo.userevents.min","kendo.draganddrop.min","kendo.mobile.scroller.min","kendo.popup.min","kendo.tooltip.min","kendo.drawing.min","kendo.dataviz.core.min","kendo.dataviz.themes.min","kendo.dataviz.chart.min","kendo.dataviz.chart.polar.min","kendo.dataviz.chart.funnel.min","kendo.dataviz.gauge.min","kendo.dataviz.barcode.min","kendo.dataviz.qrcode.min","kendo.dataviz.stock.min","kendo.dataviz.sparkline.min","kendo.dataviz.map.min","kendo.dataviz.diagram.min","kendo.dataviz.treemap.min","kendo.angular.min","kendo.webcomponents.min","kendo.angular2.min"],e)}(function(){"bundle all";return window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.modalview.min",["kendo.mobile.shim.min","kendo.mobile.view.min"],e)}(function(){return function(e,t){var n=window.kendo,i=n.mobile.ui,r=i.Shim,o=i.Widget,a="beforeOpen",s="open",l="close",c="init",d='
',u=i.View.extend({init:function(e,t){var n=this;o.fn.init.call(n,e,t),n._id(),n._wrap(),n._shim(),this.options.$angular||(n._layout(),n._scroller(),n._model()),n.element.css("display",""),n.trigger(c)},events:[c,a,s,l],options:{name:"ModalView",modal:!0,width:null,height:null},destroy:function(){o.fn.destroy.call(this),this.shim.destroy()},open:function(t){var n=this;n.target=e(t),n.shim.show(),n._invokeNgController(),n.trigger("show",{view:n})},openFor:function(e){this.trigger(a,{target:e})||(this.open(e),this.trigger(s,{target:e}))},close:function(){this.element.is(":visible")&&!this.trigger(l)&&this.shim.hide()},_wrap:function(){var e,t,n=this,i=n.element,r=n.options;e=i[0].style.width||"auto",t=i[0].style.height||"auto",i.addClass("km-modalview").wrap(d),n.wrapper=i.parent().css({width:r.width||e||300,height:r.height||t||300}).addClass("auto"==t?" km-auto-height":""),i.css({width:"",height:""})},_shim:function(){var e=this;e.shim=new r(e.wrapper,{modal:e.options.modal,position:"center center",align:"center center",effect:"fade:in",className:"km-modalview-root",hide:function(t){e.trigger(l)&&t.preventDefault()}})}});i.plugin(u)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.drawer.min",["kendo.mobile.view.min","kendo.userevents.min"],e)}(function(){return function(e,t){var n=window.kendo,i=n.mobile,r=n.support.mobileOS,o=n.effects.Transition,a=n.roleSelector,s="x",l=i.ui,c=!(r.ios&&7==r.majorVersion&&!r.appMode),d="beforeShow",u="init",h="show",f="hide",p="afterHide",m={enable:e.noop},g=l.View.extend({init:function(t,r){var o,s,l,d,h;if(e(t).parent().prepend(t),i.ui.Widget.fn.init.call(this,t,r),this.options.$angular||(this._layout(),this._scroller()),this._model(),o=this.element.closest(a("pane")).data("kendoMobilePane"))this.pane=o,this.pane.bind("viewShow",function(e){d._viewShow(e)}),this.pane.bind("sameViewRequested",function(){d.hide()}),s=this.userEvents=new n.UserEvents(o.element,{fastTap:!0,filter:a("view splitview"),allowSelection:!0});else{if(this.currentView=m,l=e(this.options.container),!l)throw Error("The drawer needs a container configuration option set.");s=this.userEvents=new n.UserEvents(l,{fastTap:!0,allowSelection:!0}),this._attachTransition(l)}d=this,h=function(e){d.visible&&(d.hide(),e.preventDefault())},this.options.swipeToOpen&&c?(s.bind("press",function(){d.transition.cancel()}),s.bind("start",function(e){d._start(e)}),s.bind("move",function(e){d._update(e)}),s.bind("end",function(e){d._end(e)}),s.bind("tap",h)):s.bind("press",h),this.leftPositioned="left"===this.options.position,this.visible=!1,this.element.hide().addClass("km-drawer").addClass(this.leftPositioned?"km-left-drawer":"km-right-drawer"),this.trigger(u)},options:{name:"Drawer",position:"left",views:[],swipeToOpenViews:[],swipeToOpen:!0,title:"",container:null},events:[d,f,p,u,h],show:function(){this._activate()&&this._show()},hide:function(){this.currentView&&(this.currentView.enable(),g.current=null,this._moveViewTo(0),this.trigger(f,{view:this}))},openFor:function(){this.visible?this.hide():this.show()},destroy:function(){l.View.fn.destroy.call(this),this.userEvents.destroy()},_activate:function(){if(this.visible)return!0;var e=this._currentViewIncludedIn(this.options.views);return!e||this.trigger(d,{view:this})?!1:(this._setAsCurrent(),this.element.show(),this.trigger(h,{view:this}),this._invokeNgController(),!0)},_currentViewIncludedIn:function(t){if(!this.pane||!t.length)return!0;var n=this.pane.view();return e.inArray(n.id.replace("#",""),t)>-1||e.inArray(n.element.attr("id"),t)>-1},_show:function(){this.currentView.enable(!1),this.visible=!0;var e=this.element.width();this.leftPositioned||(e=-e),this._moveViewTo(e)},_setAsCurrent:function(){g.last!==this&&(g.last&&g.last.element.hide(),this.element.show()),g.last=this,g.current=this},_moveViewTo:function(e){this.userEvents.cancel(),this.transition.moveTo({location:e,duration:400,ease:o.easeOutExpo})},_viewShow:function(e){return this.currentView&&this.currentView.enable(),this.currentView===e.view?(this.hide(),t):(this.currentView=e.view,this._attachTransition(e.view.element),t)},_attachTransition:function(e){var t=this,i=this.movable,r=i&&i.x;this.transition&&(this.transition.cancel(),this.movable.moveAxis("x",0)),i=this.movable=new n.ui.Movable(e),this.transition=new o({axis:s,movable:this.movable,onEnd:function(){0===i[s]&&(e[0].style.cssText="",t.element.hide(),t.trigger(p),t.visible=!1)}}),r&&(e.addClass("k-fx-hidden"),n.animationFrame(function(){e.removeClass("k-fx-hidden"),t.movable.moveAxis(s,r),t.hide()}))},_start:function(e){var i,r,o,a,s,l=e.sender;return Math.abs(e.x.velocity)e.x.velocity,(o&&s||a&&!s)&&this._activate()?(l.capture(),t):(l.cancel(),t))},_update:function(e){var t,n=this.movable,i=n.x+e.x.delta;t=this.leftPositioned?Math.min(Math.max(0,i),this.element.width()):Math.max(Math.min(0,i),-this.element.width()),this.movable.moveAxis(s,t),e.event.preventDefault(),e.event.stopPropagation()},_end:function(e){var t,n=e.x.velocity,i=Math.abs(this.movable.x)>this.element.width()/2,r=.8;t=this.leftPositioned?n>-r&&(n>r||i):r>n&&(-r>n||i),t?this._show():this.hide()}});l.plugin(g)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.splitview.min",["kendo.mobile.pane.min"],e)}(function(){return function(e,t){var n=window.kendo,i=n.mobile.ui,r=i.Widget,o="
",a=i.View,s=a.extend({init:function(t,a){var s,l,c=this;r.fn.init.call(c,t,a),t=c.element,e.extend(c,a),c._id(),c.options.$angular?c._overlay():(c._layout(),c._overlay()),c._style(),l=t.children(c._locate("modalview")),c.options.$angular?l.each(function(t,i){n.compileMobileDirective(e(i),a.$angular[0])}):n.mobile.init(l),c.panes=[],c._paramsHistory=[],c.options.$angular?(c.element.children(n.directiveSelector("pane")).each(function(){s=n.compileMobileDirective(e(this),a.$angular[0]),c.panes.push(s)}),c.element.children(n.directiveSelector("header footer")).each(function(){n.compileMobileDirective(e(this),a.$angular[0]);
})):c.content.children(n.roleSelector("pane")).each(function(){s=n.initWidget(this,{},i.roles),c.panes.push(s)}),c.expandedPaneShim=e(o).appendTo(c.element),c._shimUserEvents=new n.UserEvents(c.expandedPaneShim,{fastTap:!0,tap:function(){c.collapsePanes()}})},_locate:function(e){return this.options.$angular?n.directiveSelector(e):n.roleSelector(e)},options:{name:"SplitView",style:"horizontal"},expandPanes:function(){this.element.addClass("km-expanded-splitview")},collapsePanes:function(){this.element.removeClass("km-expanded-splitview")},_layout:function(){var e=this,t=e.element;e.transition=n.attrValue(t,"transition"),n.mobile.ui.View.prototype._layout.call(this),n.mobile.init(this.header.add(this.footer)),e.element.addClass("km-splitview"),e.content.addClass("km-split-content")},_style:function(){var t,n=this.options.style,i=this.element;n&&(t=n.split(" "),e.each(t,function(){i.addClass("km-split-"+this)}))},showStart:function(){var t=this;t.element.css("display",""),t.inited?this._invokeNgController():(t.inited=!0,e.each(t.panes,function(){this.options.initial?this.navigateToInitial():this.navigate("")}),t.trigger("init",{view:t})),t.trigger("show",{view:t})}});i.plugin(s)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.application.min",["kendo.mobile.pane.min","kendo.router.min"],e)}(function(){return function(e,t){function n(e,t){var n=[];return p&&n.push("km-on-"+p.name),n.push(e.skin?"km-"+e.skin:"ios"==e.name&&e.majorVersion>6?"km-ios7":"km-"+e.name),("ios"==e.name&&7>e.majorVersion||"ios"!=e.name)&&n.push("km-"+e.name+e.majorVersion),n.push("km-"+e.majorVersion),n.push("km-m"+(e.minorVersion?e.minorVersion[0]:0)),e.variant&&(e.skin&&e.skin===e.name||!e.skin||e.setDefaultPlatform===!1)&&n.push("km-"+(e.skin?e.skin:e.name)+"-"+e.variant),e.cordova&&n.push("km-cordova"),n.push(e.appMode?"km-app":"km-web"),t&&t.statusBarStyle&&n.push("km-"+t.statusBarStyle+"-status-bar"),n.join(" ")}function i(t){return"km-wp-"+(t.noVariantSet?0===parseInt(e("
").css("background-color").split(",")[1],10)?"dark":"light":t.variant+" km-wp-"+t.variant+"-force")}function r(e){return p.wp?"-kendo-landscape"==e.css("animation-name"):Math.abs(window.orientation)/90==1}function o(e){return r(e)?y:v}function a(e){e.parent().addBack().css("min-height",window.innerHeight)}function s(){e("meta[name=viewport]").remove(),z.append(x({height:", width=device-width"+(r()?", height="+window.innerHeight+"px":d.mobileOS.flatVersion>=600&&700>d.mobileOS.flatVersion?", height="+window.innerWidth+"px":", height=device-height")}))}var l=window.kendo,c=l.mobile,d=l.support,u=c.ui.Widget,h=c.ui.Pane,f="ios7",p=d.mobileOS,m="blackberry"==p.device&&p.flatVersion>=600&&1e3>p.flatVersion&&p.appMode,g=.93,v="km-vertical",_="chrome"===p.browser,b=p.ios&&p.flatVersion>=700&&800>p.flatVersion&&(p.appMode||_),w=Math.abs(window.orientation)/90==1,y="km-horizontal",k={ios7:{ios:!0,browser:"default",device:"iphone",flatVersion:"700",majorVersion:"7",minorVersion:"0.0",name:"ios",tablet:!1},ios:{ios:!0,browser:"default",device:"iphone",flatVersion:"612",majorVersion:"6",minorVersion:"1.2",name:"ios",tablet:!1},android:{android:!0,browser:"default",device:"android",flatVersion:"442",majorVersion:"4",minorVersion:"4.2",name:"android",tablet:!1},blackberry:{blackberry:!0,browser:"default",device:"blackberry",flatVersion:"710",majorVersion:"7",minorVersion:"1.0",name:"blackberry",tablet:!1},meego:{meego:!0,browser:"default",device:"meego",flatVersion:"850",majorVersion:"8",minorVersion:"5.0",name:"meego",tablet:!1},wp:{wp:!0,browser:"default",device:"wp",flatVersion:"800",majorVersion:"8",minorVersion:"0.0",name:"wp",tablet:!1}},x=l.template(' ',{usedWithBlock:!1}),C=l.template(' ',{usedWithBlock:!1}),S=l.template("",{usedWithBlock:!1}),T=p.android&&"chrome"!=p.browser||p.blackberry,D=l.template(' ',{usedWithBlock:!1}),A=("iphone"==p.device||"ipod"==p.device)&&7>p.majorVersion,E=("iphone"==p.device||"ipod"==p.device)&&p.majorVersion>=7,F=E?"none":null,I="mobilesafari"==p.browser?60:0,M=20,R=e(window),P=window.screen,z=e("head"),B="init",L=e.proxy,H=u.extend({init:function(t,n){c.application=this,e(e.proxy(this,"bootstrap",t,n))},bootstrap:function(t,n){var i,r,o;t=e(t),t[0]||(t=e(document.body)),u.fn.init.call(this,t,n),this.element.removeAttr("data-"+l.ns+"role"),this._setupPlatform(),this._attachMeta(),this._setupElementClass(),this._attachHideBarHandlers(),i=e.extend({},this.options),delete i.name,r=this,o=function(){r.pane=new h(r.element,i),r.pane.navigateToInitial(),r.options.updateDocumentTitle&&r._setupDocumentTitle(),r._startHistory(),r.trigger(B)},this.options.$angular?setTimeout(o):o()},options:{name:"Application",hideAddressBar:!0,browserHistory:!0,historyTransition:F,modelScope:window,statusBarStyle:"black",transition:"",retina:!1,platform:null,skin:null,updateDocumentTitle:!0,useNativeScrolling:!1},events:[B],navigate:function(e,t){this.pane.navigate(e,t)},replace:function(e,t){this.pane.replace(e,t)},scroller:function(){return this.view().scroller},hideLoading:function(){if(!this.pane)throw Error("The mobile application instance is not fully instantiated. Please consider activating loading in the application init event handler.");this.pane.hideLoading()},showLoading:function(){if(!this.pane)throw Error("The mobile application instance is not fully instantiated. Please consider activating loading in the application init event handler.");this.pane.showLoading()},changeLoadingMessage:function(e){if(!this.pane)throw Error("The mobile application instance is not fully instantiated. Please consider changing the message in the application init event handler.");this.pane.changeLoadingMessage(e)},view:function(){return this.pane.view()},skin:function(e){var t=this;return arguments.length?(t.options.skin=e||"",t.element[0].className="km-pane",t._setupPlatform(),t._setupElementClass(),t.options.skin):t.options.skin},destroy:function(){u.fn.destroy.call(this),this.pane.destroy(),this.router.destroy()},_setupPlatform:function(){var t=this,r=t.options.platform,o=t.options.skin,a=[],s=p||k[f];r&&(s.setDefaultPlatform=!0,"string"==typeof r?(a=r.split("-"),s=e.extend({variant:a[1]},s,k[a[0]])):s=r),o&&(a=o.split("-"),p||(s.setDefaultPlatform=!1),s=e.extend({},s,{skin:a[0],variant:a[1]})),s.variant||(s.noVariantSet=!0,s.variant="dark"),t.os=s,t.osCssClass=n(t.os,t.options),"wp"==s.name&&(t.refreshBackgroundColorProxy||(t.refreshBackgroundColorProxy=e.proxy(function(){(t.os.variant&&t.os.skin&&t.os.skin===t.os.name||!t.os.skin)&&t.element.removeClass("km-wp-dark km-wp-light km-wp-dark-force km-wp-light-force").addClass(i(t.os))},t)),e(document).off("visibilitychange",t.refreshBackgroundColorProxy),e(document).off("resume",t.refreshBackgroundColorProxy),s.skin||(t.element.parent().css("overflow","hidden"),e(document).on("visibilitychange",t.refreshBackgroundColorProxy),e(document).on("resume",t.refreshBackgroundColorProxy),t.refreshBackgroundColorProxy()))},_startHistory:function(){this.options.browserHistory?(this.router=new l.Router({pushState:this.options.pushState,root:this.options.root,hashBang:this.options.hashBang}),this.pane.bindToRouter(this.router),this.router.start()):this.options.initial||this.pane.navigate("")},_resizeToScreenHeight:function(){var t,n=e("meta[name=apple-mobile-web-app-status-bar-style]").attr("content").match(/black-translucent|hidden/),i=this.element;t=_?window.innerHeight:r(i)?n?w?P.availWidth+M:P.availWidth:w?P.availWidth:P.availWidth-M:n?w?P.availHeight:P.availHeight+M:w?P.availHeight-M:P.availHeight,i.height(t)},_setupElementClass:function(){var t,n=this,i=n.element;i.parent().addClass("km-root km-"+(n.os.tablet?"tablet":"phone")),i.addClass(n.osCssClass+" "+o(i)),this.options.useNativeScrolling&&i.parent().addClass("km-native-scrolling"),_&&i.addClass("km-ios-chrome"),d.wpDevicePixelRatio&&i.parent().css("font-size",d.wpDevicePixelRatio+"em"),this.options.retina&&(i.parent().addClass("km-retina"),i.parent().css("font-size",d.devicePixelRatio*g+"em")),m&&s(),n.options.useNativeScrolling?i.parent().addClass("km-native-scrolling"):T&&(t=(screen.availWidth>screen.availHeight?screen.availWidth:screen.availHeight)+200,e(S({width:t,height:t})).appendTo(z)),b&&n._resizeToScreenHeight(),l.onResize(function(){i.removeClass("km-horizontal km-vertical").addClass(o(i)),n.options.useNativeScrolling&&a(i),b&&n._resizeToScreenHeight(),m&&s(),l.resize(i)})},_clearExistingMeta:function(){z.find("meta").filter("[name|='apple-mobile-web-app'],[name|='msapplication-tap'],[name='viewport']").remove()},_attachMeta:function(){var e,t=this.options,n=t.icon;if(this._clearExistingMeta(),m||z.prepend(x({height:"",scale:this.options.retina?1/d.devicePixelRatio:"1.0"})),z.prepend(C(t)),n){"string"==typeof n&&(n={"":n});for(e in n)z.prepend(D({icon:n[e],size:e}))}t.useNativeScrolling&&a(this.element)},_attachHideBarHandlers:function(){var e=this,t=L(e,"_hideBar");!d.mobileOS.appMode&&e.options.hideAddressBar&&A&&!e.options.useNativeScrolling&&(e._initialHeight={},R.on("load",t),l.onResize(function(){setTimeout(window.scrollTo,0,0,1)}))},_setupDocumentTitle:function(){var e=this,n=document.title;e.pane.bind("viewShow",function(e){var i=e.view.title;document.title=i!==t?i:n})},_hideBar:function(){var t=this,n=t.element;n.height(l.support.transforms.css+"calc(100% + "+I+"px)"),e(window).trigger(l.support.resize)}});l.mobile.Application=H,l.ui.plugin(H,l.mobile,"Mobile")}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.button.min",["kendo.userevents.min"],e)}(function(){return function(e,t){function n(t,n,i){e(n.target).closest(".km-button,.km-detail").toggleClass("km-state-active",i),d&&t.deactivateTimeoutID&&(clearTimeout(t.deactivateTimeoutID),t.deactivateTimeoutID=0)}function i(t){return e(''+t+" ")}var r=window.kendo,o=r.mobile,a=o.ui,s=a.Widget,l=r.support,c=l.mobileOS,d=c.android&&c.flatVersion>=300,u="click",h="disabled",f="km-state-disabled",p=s.extend({init:function(e,t){var i,o=this;s.fn.init.call(o,e,t),i="up"===o.options.clickOn,o._wrap(),o._style(),i||o.element.attr("data-navigate-on-press",!0),o.options.enable=o.options.enable&&!o.element.attr(h),o.enable(o.options.enable),o._userEvents=new r.UserEvents(o.element,{allowSelection:!i,fastTap:!0,press:function(e){o._activate(e)},release:function(e){n(o,e,!1),i||e.event.stopPropagation()}}),o._userEvents.bind(i?"tap":"press",function(e){o._release(e)}),d&&o.element.on("move",function(e){o._timeoutDeactivate(e)})},destroy:function(){s.fn.destroy.call(this),this._userEvents.destroy()},events:[u],options:{name:"Button",icon:"",style:"",badge:"",clickOn:"up",enable:!0},badge:function(e){var t=this.badgeElement=this.badgeElement||i(e).appendTo(this.element);return e||0===e?(t.html(e),this):e===!1?(t.empty().remove(),this.badgeElement=!1,this):t.html()},enable:function(e){var n=this.element;t===e&&(e=!0),this.options.enable=e,e?n.removeAttr(h):n.attr(h,h),n.toggleClass(f,!e)},_timeoutDeactivate:function(e){this.deactivateTimeoutID||(this.deactivateTimeoutID=setTimeout(n,500,this,e,!1))},_activate:function(e){var t=document.activeElement,i=t?t.nodeName:"";this.options.enable&&(n(this,e,!0),("INPUT"==i||"TEXTAREA"==i)&&t.blur())},_release:function(n){var i=this;if(!(n.which>1))return i.options.enable?(i.trigger(u,{target:e(n.target),button:i.element})&&n.preventDefault(),t):(n.preventDefault(),t)},_style:function(){var t,n=this.options.style,i=this.element;n&&(t=n.split(" "),e.each(t,function(){i.addClass("km-"+this)}))},_wrap:function(){var t=this,n=t.options.icon,r=t.options.badge,o=' ').children("span.km-text")),!l[0]&&n&&(s[0]||(o+=" km-notext"),t.iconElement=a.prepend(e(o+'" />'))),(r||0===r)&&(t.badgeElement=i(r).appendTo(a))}}),m=p.extend({options:{name:"BackButton",style:"back"},init:function(e,n){var i=this;p.fn.init.call(i,e,n),t===i.element.attr("href")&&i.element.attr("href","#:back")}}),g=p.extend({options:{name:"DetailButton",style:""},init:function(e,t){p.fn.init.call(this,e,t)},_style:function(){var t,n=this.options.style+" detail",i=this.element;n&&(t=n.split(" "),e.each(t,function(){i.addClass("km-"+this)}))},_wrap:function(){var t=this,n=t.options.icon,i=' ')))}});a.plugin(p),a.plugin(m),a.plugin(g)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.buttongroup.min",["kendo.core.min"],e)}(function(){return function(e,t){function n(t){return e(''+t+" ")}var i=window.kendo,r=i.mobile.ui,o=r.Widget,a="km-state-active",s="km-state-disabled",l="select",c="li:not(."+a+")",d=o.extend({init:function(e,t){var n=this;o.fn.init.call(n,e,t),n.element.addClass("km-buttongroup").find("li").each(n._button),n.element.on(n.options.selectOn,c,"_select"),n._enable=!0,n.select(n.options.index),n.options.enable||(n._enable=!1,n.wrapper.addClass(s))},events:[l],options:{name:"ButtonGroup",selectOn:"down",index:-1,enable:!0},current:function(){return this.element.find("."+a)},select:function(n){var i=this,r=-1;n!==t&&-1!==n&&i._enable&&!e(n).is("."+s)&&(i.current().removeClass(a),"number"==typeof n?(r=n,n=e(i.element[0].children[n])):n.nodeType&&(n=e(n),r=n.index()),n.addClass(a),i.selectedIndex=r)},badge:function(t,i){var r,o=this.element;return isNaN(t)||(t=o.children().get(t)),t=o.find(t),r=e(t.children(".km-badge")[0]||n(i).appendTo(t)),i||0===i?(r.html(i),this):i===!1?(r.empty().remove(),this):r.html()},enable:function(e){var n=this.wrapper;t===e&&(e=!0),e?n.removeClass(s):n.addClass(s),this._enable=this.options.enable=e},_button:function(){var t=e(this).addClass("km-button"),r=i.attrValue(t,"icon"),o=i.attrValue(t,"badge"),a=t.children("span"),s=t.find("img").addClass("km-image");a[0]||(a=t.wrapInner(" ").children("span")),a.addClass("km-text"),!s[0]&&r&&t.prepend(e(' ')),(o||0===o)&&n(o).appendTo(t)},_select:function(e){e.which>1||e.isDefaultPrevented()||!this._enable||(this.select(e.currentTarget),this.trigger(l,{index:this.selectedIndex}))}});r.plugin(d)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.collapsible.min",["kendo.core.min"],e)}(function(){return function(e,t){var n=window.kendo,i=n.mobile.ui,r=i.Widget,o="km-collapsible",a="km-collapsible-header",s="km-collapsible-content",l="km-collapsibleinset",c="
",d="
",u="km-collapsed",h="km-expanded",f="km-animated",p="left",m="expand",g="collapse",v=r.extend({init:function(t,i){var a=this,s=e(t);r.fn.init.call(a,s,i),s.addClass(o),a._buildHeader(),a.content=s.children().not(a.header).wrapAll(d).parent(),a._userEvents=new n.UserEvents(a.header,{fastTap:!0,tap:function(){a.toggle()}}),s.addClass(a.options.collapsed?u:h),a.options.inset&&s.addClass(l),a.options.animation?(a.content.addClass(f),a.content.height(0),a.options.collapsed&&a.content.hide()):a.options.collapsed&&a.content.hide()},events:[m,g],options:{name:"Collapsible",collapsed:!0,collapseIcon:"arrow-n",expandIcon:"arrow-s",iconPosition:p,animation:!0,inset:!1},destroy:function(){r.fn.destroy.call(this),this._userEvents.destroy()},expand:function(e){var t=this.options.collapseIcon,i=this.content,r=n.support.mobileOS.ios;this.trigger(m)||(t&&this.header.find(".km-icon").removeClass().addClass("km-icon km-"+t),this.element.removeClass(u).addClass(h),this.options.animation&&!e?(i.off("transitionend"),i.show(),r&&i.removeClass(f),i.height(this._getContentHeight()),r&&i.addClass(f),n.resize(i)):i.show())},collapse:function(e){var t=this.options.expandIcon,n=this.content;this.trigger(g)||(t&&this.header.find(".km-icon").removeClass().addClass("km-icon km-"+t),this.element.removeClass(h).addClass(u),this.options.animation&&!e?(n.one("transitionend",function(){n.hide()}),n.height(0)):n.hide())},toggle:function(e){this.isCollapsed()?this.expand(e):this.collapse(e)},isCollapsed:function(){return this.element.hasClass(u)},resize:function(){!this.isCollapsed()&&this.options.animation&&this.content.height(this._getContentHeight())},_buildHeader:function(){var t=this.element.children(":header").wrapAll(c),n=e(' '),i=this.options.collapsed?this.options.expandIcon:this.options.collapseIcon,r=this.options.iconPosition;i&&(t.prepend(n),n.addClass("km-"+i)),this.header=t.parent(),this.header.addClass("km-icon-"+r)},_getContentHeight:function(){var e,t=this.content.attr("style");return this.content.css({position:"absolute",visibility:"hidden",height:"auto"}),e=this.content.height(),this.content.attr("style",t?t:""),e}});i.plugin(v)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.listview.min",["kendo.data.min","kendo.userevents.min","kendo.mobile.button.min"],e)}(function(){return function(e,t){function n(){return this.nodeType===v.TEXT_NODE&&this.nodeValue.match(U)}function i(e,t){t&&!e[0].querySelector(".km-icon")&&e.prepend(' ')}function r(e){i(e,T(e,"icon")),i(e,T(e.children(C),"icon"))}function o(e){var t=e.parent(),r=e.add(t.children(g.roleSelector("detailbutton"))),o=t.contents().not(r).not(n);o.length||(e.addClass("km-listview-link").attr(g.attr("role"),"listview-link"),i(e,T(t,"icon")),i(e,T(e,"icon")))}function a(e){if(e[0].querySelector("input[type=checkbox],input[type=radio]")){var t=e.parent();t.contents().not(e).not(function(){return 3==this.nodeType})[0]||(e.addClass("km-listview-label"),e.children("[type=checkbox],[type=radio]").addClass("km-widget km-icon km-check"))}}function s(t,n){e(t).css("transform","translate3d(0px, "+n+"px, 0px)")}var l,c,d,u,h,f,p,m,g=window.kendo,v=window.Node,_=g.mobile,b=_.ui,w=g.data.DataSource,y=b.DataBoundWidget,k=".km-list > li, > li:not(.km-group-container)",x=".km-listview-link, .km-listview-label",C="["+g.attr("icon")+"]",S=e.proxy,T=g.attrValue,D="km-group-title",A="km-state-active",E='',F=g.template('#= this.headerTemplate(data) #
#= kendo.render(this.template, data.items)# '),I='
',M=g.template(''),R=".kendoMobileListView",P="styled",z="dataBound",B="dataBinding",L="itemChange",H="click",N="change",O="progress",V="function",U=/^\s+$/,W=/button/,j=g.Class.extend({init:function(e){var t,n,i=e.scroller();i&&(this.options=e.options,this.element=e.element,this.scroller=e.scroller(),this._shouldFixHeaders(),t=this,n=function(){t._cacheHeaders()},e.bind("resize",n),e.bind(P,n),e.bind(z,n),i.bind("scroll",function(e){t._fixHeader(e)}))},_fixHeader:function(t){if(this.fixedHeaders){var n,i,r,o=0,a=this.scroller,s=this.headers,l=t.scrollTop;do{if(n=s[o++],!n){r=e("
");break}i=n.offset,r=n.header}while(i+1>l);this.currentHeader!=o&&(a.fixedContainer.html(r.clone()),this.currentHeader=o)}},_shouldFixHeaders:function(){this.fixedHeaders="group"===this.options.type&&this.options.fixedHeaders},_cacheHeaders:function(){if(this._shouldFixHeaders(),this.fixedHeaders){var t=[],n=this.scroller.scrollTop;this.element.find("."+D).each(function(i,r){r=e(r),t.unshift({offset:r.position().top+n,header:r})}),this.headers=t,this._fixHeader({scrollTop:n})}}}),q=function(){return{page:1}},G=g.Class.extend({init:function(e){var t=this,n=e.options,i=e.scroller(),r=n.pullParameters||q;this.listView=e,this.scroller=i,e.bind("_dataSource",function(e){t.setDataSource(e.dataSource)}),i.setOptions({pullToRefresh:!0,pull:function(){t._pulled||(t._pulled=!0,t.dataSource.read(r.call(e,t._first)))},messages:{pullTemplate:n.messages.pullTemplate,releaseTemplate:n.messages.releaseTemplate,refreshTemplate:n.messages.refreshTemplate}})},setDataSource:function(e){var t=this;this._first=e.view()[0],this.dataSource=e,e.bind("change",function(){t._change()}),e.bind("error",function(){t._change()})},_change:function(){var e,t=this.scroller,n=this.dataSource;this._pulled&&t.pullHandled(),(this._pulled||!this._first)&&(e=n.view(),e[0]&&(this._first=e[0])),this._pulled=!1}}),$=g.Observable.extend({init:function(e){var t=this;g.Observable.fn.init.call(t),t.buffer=e.buffer,t.height=e.height,t.item=e.item,t.items=[],t.footer=e.footer,t.buffer.bind("reset",function(){t.refresh()})},refresh:function(){for(var e,t,n,i,r=this.buffer,o=this.items,a=!1;o.length;)o.pop().destroy();for(this.offset=r.offset,e=this.item,i=0;r.viewSize>i;i++){if(i===r.total()){a=!0;break}n=e(this.content(this.offset+o.length)),n.below(t),t=n,o.push(n)}this.itemCount=o.length,this.trigger("reset"),this._resize(),a&&this.trigger("endReached")},totalHeight:function(){if(!this.items[0])return 0;var e=this,t=e.items,n=t[0].top,i=t[t.length-1].bottom,r=(i-n)/e.itemCount,o=e.buffer.length-e.offset-e.itemCount;return(this.footer?this.footer.height:0)+i+o*r},batchUpdate:function(e){var t,n,i=this.height(),r=this.items,o=this.offset;if(r[0]){if(this.lastDirection)for(;r[r.length-1].bottom>e+2*i&&0!==this.offset;)this.offset--,t=r.pop(),t.update(this.content(this.offset)),t.above(r[0]),r.unshift(t);else for(;e-i>r[0].top;){if(n=this.offset+this.itemCount,n===this.buffer.total()){this.trigger("endReached");break}if(n===this.buffer.length)break;t=r.shift(),t.update(this.content(this.offset+this.itemCount)),t.below(r[r.length-1]),r.push(t),this.offset++}o!==this.offset&&this._resize()}},update:function(e){var t,n,i,r,o=this,a=this.items,s=this.height(),l=this.itemCount,c=s/2,d=(this.lastTop||0)>e,u=e-c,h=e+s+c;a[0]&&(this.lastTop=e,this.lastDirection=d,d?a[0].top>u&&a[a.length-1].bottom>h+c&&this.offset>0&&(this.offset--,t=a.pop(),n=a[0],t.update(this.content(this.offset)),a.unshift(t),t.above(n),o._resize()):h>a[a.length-1].bottom&&u-c>a[0].top&&(r=this.offset+l,r===this.buffer.total()?this.trigger("endReached"):r!==this.buffer.length&&(t=a.shift(),i=a[a.length-1],a.push(t),t.update(this.content(this.offset+this.itemCount)),o.offset++,t.below(i),o._resize())))},content:function(e){return this.buffer.at(e)},destroy:function(){this.unbind()},_resize:function(){var e=this.items,t=0,n=0,i=e[0],r=e[e.length-1];i&&(t=i.top,n=r.bottom),this.trigger("resize",{top:t,bottom:n}),this.footer&&this.footer.below(r)}});g.mobile.ui.VirtualList=$,l=g.Class.extend({init:function(t,n){var i=t.append([n],!0)[0],r=i.offsetHeight;e.extend(this,{top:0,element:i,listView:t,height:r,bottom:r})},update:function(e){this.element=this.listView.setDataItem(this.element,e)},above:function(e){e&&(this.height=this.element.offsetHeight,this.top=e.top-this.height,this.bottom=e.top,s(this.element,this.top))},below:function(e){e&&(this.height=this.element.offsetHeight,this.top=e.bottom,this.bottom=this.top+this.height,s(this.element,this.top))},destroy:function(){g.destroy(this.element),e(this.element).remove()}}),c='
',d=g.Class.extend({init:function(t){this.element=e(' ').appendTo(t.element),this._loadIcon=e(c).appendTo(this.element)},enable:function(){this.element.show(),this.height=this.element.outerHeight(!0)},disable:function(){this.element.hide(),this.height=0},below:function(e){e&&(this.top=e.bottom,this.bottom=this.height+this.top,s(this.element,this.top))}}),u=d.extend({init:function(t,n){this._loadIcon=e(c).hide(),this._loadButton=e(''+t.options.messages.loadMoreText+" ").hide(),this.element=e(' ').append(this._loadIcon).append(this._loadButton).appendTo(t.element);var i=this;this._loadButton.kendoMobileButton().data("kendoMobileButton").bind("click",function(){i._hideShowButton(),n.next()}),n.bind("resize",function(){i._showLoadButton()}),this.height=this.element.outerHeight(!0),this.disable()},_hideShowButton:function(){this._loadButton.hide(),this.element.addClass("km-scroller-refresh"),this._loadIcon.css("display","block")},_showLoadButton:function(){this._loadButton.show(),this.element.removeClass("km-scroller-refresh"),this._loadIcon.hide()}}),h=g.Class.extend({init:function(e){var t=this;this.chromeHeight=e.wrapper.children().not(e.element).outerHeight()||0,this.listView=e,this.scroller=e.scroller(),this.options=e.options,e.bind("_dataSource",function(e){t.setDataSource(e.dataSource,e.empty)}),e.bind("resize",function(){t.list.items.length&&(t.scroller.reset(),t.buffer.range(0),t.list.refresh())}),this.scroller.makeVirtual(),this.scroller.bind("scroll",function(e){t.list.update(e.scrollTop)}),this.scroller.bind("scrollEnd",function(e){t.list.batchUpdate(e.scrollTop)})},destroy:function(){this.list.unbind(),this.buffer.unbind()},setDataSource:function(t,n){var i,r,o,a,s=this,c=this.options,h=this.listView,f=h.scroller(),p=c.loadMore;if(this.dataSource=t,i=t.pageSize()||c.virtualViewSize,!i&&!n)throw Error("the DataSource does not have page size configured. Page Size setting is mandatory for the mobile listview virtual scrolling to work as expected.");this.buffer&&this.buffer.destroy(),r=new g.data.Buffer(t,Math.floor(i/2),p),o=p?new u(h,r):new d(h),this.list&&this.list.destroy(),a=new $({buffer:r,footer:o,item:function(e){return new l(h,e)},height:function(){return f.height()}}),a.bind("resize",function(){s.updateScrollerSize(),h.updateSize()}),a.bind("reset",function(){s.footer.enable()}),a.bind("endReached",function(){o.disable(),s.updateScrollerSize()}),r.bind("expand",function(){a.lastDirection=!1,a.batchUpdate(f.scrollTop)}),e.extend(this,{buffer:r,scroller:f,list:a,footer:o})},updateScrollerSize:function(){this.scroller.virtualSize(0,this.list.totalHeight()+this.chromeHeight)},refresh:function(){this.list.refresh()},reset:function(){this.buffer.range(0),this.list.refresh()}}),f=g.Class.extend({init:function(e){var t,n=this;this.listView=e,this.options=e.options,t=this,this._refreshHandler=function(e){t.refresh(e)},this._progressHandler=function(){e.showLoading()},e.bind("_dataSource",function(e){n.setDataSource(e.dataSource)})},destroy:function(){this._unbindDataSource()},reset:function(){},refresh:function(e){var n,i,r,o,a,s,l,c=e&&e.action,d=e&&e.items,u=this.listView,h=this.dataSource,f=this.options.appendOnRefresh,p=h.view(),m=h.group(),g=m&&m[0];return"itemchange"===c?(u._hasBindingTarget()||(n=u.findByDataItem(d)[0],n&&u.setDataItem(n,d[0])),t):(a="add"===c&&!g||f&&!u._filter,s="remove"===c&&!g,a?i=[]:s&&(i=u.findByDataItem(d)),u.trigger(B,{action:c||"rebind",items:d,removedItems:i,index:e&&e.index})?(this._shouldShowLoading()&&u.hideLoading(),t):("add"!==c||g?"remove"!==c||g?g?u.replaceGrouped(p):f&&!u._filter?(r=u.prepend(p),o=p):u.replace(p):(r=[],u.remove(d)):(l=p.indexOf(d[0]),l>-1&&(r=u.insertAt(d,l),o=d)),this._shouldShowLoading()&&u.hideLoading(),u.trigger(z,{ns:b,addedItems:r,addedDataItems:o}),t))},setDataSource:function(e){this.dataSource&&this._unbindDataSource(),this.dataSource=e,e.bind(N,this._refreshHandler),this._shouldShowLoading()&&this.dataSource.bind(O,this._progressHandler)},_unbindDataSource:function(){this.dataSource.unbind(N,this._refreshHandler).unbind(O,this._progressHandler)},_shouldShowLoading:function(){var e=this.options;return!e.pullToRefresh&&!e.loadMore&&!e.endlessScroll}}),p=g.Class.extend({init:function(t){var n=this,i=t.options.filterable,r="change paste",o=this;this.listView=t,this.options=i,t.element.before(M({placeholder:i.placeholder||"Search..."})),i.autoFilter!==!1&&(r+=" keyup"),this.element=t.wrapper.find(".km-search-form"),this.searchInput=t.wrapper.find("input[type=search]").closest("form").on("submit"+R,function(e){e.preventDefault()}).end().on("focus"+R,function(){n._oldFilter=n.searchInput.val()}).on(r.split(" ").join(R+" ")+R,S(this._filterChange,this)),this.clearButton=t.wrapper.find(".km-filter-reset").on(H,S(this,"_clearFilter")).hide(),this._dataSourceChange=e.proxy(this._refreshInput,this),t.bind("_dataSource",function(e){e.dataSource.bind("change",o._dataSourceChange)})},_refreshInput:function(){var e=this.listView.dataSource.filter(),t=this.listView._filter.searchInput;t.val(e&&e.filters[0].field===this.listView.options.filterable.field?e.filters[0].value:"")},_search:function(e){this._filter=!0,this.clearButton[e?"show":"hide"](),this.listView.dataSource.filter(e)},_filterChange:function(e){var t=this;"paste"==e.type&&this.options.autoFilter!==!1?setTimeout(function(){t._applyFilter()},1):this._applyFilter()},_applyFilter:function(){var e=this.options,t=this.searchInput.val(),n=t.length?{field:e.field,operator:e.operator||"startswith",ignoreCase:e.ignoreCase,value:t}:null;t!==this._oldFilter&&(this._oldFilter=t,this._search(n))},_clearFilter:function(e){this.searchInput.val(""),this._search(null),e.preventDefault()}}),m=y.extend({init:function(t,n){var i=this;y.fn.init.call(this,t,n),t=this.element,n=this.options,n.scrollTreshold&&(n.scrollThreshold=n.scrollTreshold),t.on("down",x,"_highlight").on("move up cancel",x,"_dim"),this._userEvents=new g.UserEvents(t,{fastTap:!0,filter:k,allowSelection:!0,tap:function(e){i._click(e)}}),t.css("-ms-touch-action","auto"),t.wrap(I),this.wrapper=this.element.parent(),this._headerFixer=new j(this),this._itemsCache={},this._templates(),this.virtual=n.endlessScroll||n.loadMore,this._style(),this.options.$angular&&(this.virtual||this.options.pullToRefresh)?setTimeout(e.proxy(this,"_start")):this._start()},_start:function(){var e=this.options;this.options.filterable&&(this._filter=new p(this)),this._itemBinder=this.virtual?new h(this):new f(this),this.options.pullToRefresh&&(this._pullToRefreshHandler=new G(this)),this.setDataSource(e.dataSource),this._enhanceItems(this.items()),g.notify(this,b)},events:[H,B,z,L],options:{name:"ListView",style:"",type:"flat",autoBind:!0,fixedHeaders:!1,template:"#:data#",headerTemplate:'#:value# ',appendOnRefresh:!1,loadMore:!1,endlessScroll:!1,scrollThreshold:30,pullToRefresh:!1,messages:{loadMoreText:"Press to load more",pullTemplate:"Pull to refresh",releaseTemplate:"Release to refresh",refreshTemplate:"Refreshing"},pullOffset:140,filterable:!1,virtualViewSize:null},refresh:function(){this._itemBinder.refresh()},reset:function(){this._itemBinder.reset()},setDataSource:function(e){var t=!e;this.dataSource=w.create(e),this.trigger("_dataSource",{dataSource:this.dataSource,empty:t}),this.options.autoBind&&!t&&(this.items().remove(),this.dataSource.fetch())},destroy:function(){y.fn.destroy.call(this),g.destroy(this.element),this._userEvents.destroy(),this._itemBinder&&this._itemBinder.destroy(),
this.element.unwrap(),delete this.element,delete this.wrapper,delete this._userEvents},items:function(){return"group"===this.options.type?this.element.find(".km-list").children():this.element.children().not(".km-load-more")},scroller:function(){return this._scrollerInstance||(this._scrollerInstance=this.element.closest(".km-scroll-wrapper").data("kendoMobileScroller")),this._scrollerInstance},showLoading:function(){var e=this.view();e&&e.loader&&e.loader.show()},hideLoading:function(){var e=this.view();e&&e.loader&&e.loader.hide()},insertAt:function(e,t,n){var i=this;return i._renderItems(e,function(r){if(0===t?i.element.prepend(r):-1===t?i.element.append(r):i.items().eq(t-1).after(r),n)for(var o=0;r.length>o;o++)i.trigger(L,{item:r.eq(o),data:e[o],ns:b})})},append:function(e,t){return this.insertAt(e,-1,t)},prepend:function(e,t){return this.insertAt(e,0,t)},replace:function(e){return this.options.type="flat",this._angularItems("cleanup"),this.element.empty(),this._userEvents.cancel(),this._style(),this.insertAt(e,0)},replaceGrouped:function(t){this.options.type="group",this._angularItems("cleanup"),this.element.empty();var n=e(g.render(this.groupTemplate,t));this._enhanceItems(n.children("ul").children("li")),this.element.append(n),_.init(n),this._style(),this._angularItems("compile")},remove:function(e){var t=this.findByDataItem(e);this.angular("cleanup",function(){return{elements:t}}),g.destroy(t),t.remove()},findByDataItem:function(e){var t,n,i=[];for(t=0,n=e.length;n>t;t++)i[t]="[data-"+g.ns+"uid="+e[t].uid+"]";return this.element.find(i.join(","))},setDataItem:function(t,n){var i=this,r=function(r){var o=e(r[0]);g.destroy(t),i.angular("cleanup",function(){return{elements:[e(t)]}}),e(t).replaceWith(o),i.trigger(L,{item:o,data:n,ns:b})};return this._renderItems([n],r)[0]},updateSize:function(){this._size=this.getSize()},_renderItems:function(t,n){var i=e(g.render(this.template,t));return n(i),this.angular("compile",function(){return{elements:i,data:t.map(function(e){return{dataItem:e}})}}),_.init(i),this._enhanceItems(i),i},_dim:function(e){this._toggle(e,!1)},_highlight:function(e){this._toggle(e,!0)},_toggle:function(t,n){if(!(t.which>1)){var i=e(t.currentTarget),r=i.parent(),o=T(i,"role")||"",a=!o.match(W),s=t.isDefaultPrevented();a&&r.toggleClass(A,n&&!s)}},_templates:function(){var e=this.options.template,t=this.options.headerTemplate,n=' data-uid="#=arguments[0].uid || ""#"',i={},r={};typeof e===V&&(i.template=e,e="#=this.template(data)#"),this.template=S(g.template(""+e+" "),i),r.template=this.template,typeof t===V&&(r._headerTemplate=t,t="#=this._headerTemplate(data)#"),r.headerTemplate=g.template(t),this.groupTemplate=S(F,r)},_click:function(t){if(!(t.event.which>1||t.event.isDefaultPrevented())){var n,i=t.target,r=e(t.event.target),o=r.closest(g.roleSelector("button","detailbutton","backbutton")),a=g.widgetInstance(o,b),s=i.attr(g.attr("uid"));s&&(n=this.dataSource.getByUid(s)),this.trigger(H,{target:r,item:i,dataItem:n,button:a})&&t.preventDefault()}},_styleGroups:function(){var t=this.element.children();t.children("ul").addClass("km-list"),t.each(function(){var t=e(this),n=t.contents().first();t.addClass("km-group-container"),n.is("ul")||n.is("div."+D)||n.wrap(E)})},_style:function(){var e=this.options,t="group"===e.type,n=this.element,i="inset"===e.style;n.addClass("km-listview").toggleClass("km-list",!t).toggleClass("km-virtual-list",this.virtual).toggleClass("km-listinset",!t&&i).toggleClass("km-listgroup",t&&!i).toggleClass("km-listgroupinset",t&&i),n.parents(".km-listview")[0]||n.closest(".km-content").toggleClass("km-insetcontent",i),t&&this._styleGroups(),this.trigger(P)},_enhanceItems:function(t){t.each(function(){var t,n=e(this),i=!1;n.children().each(function(){t=e(this),t.is("a")?(o(t),i=!0):t.is("label")&&(a(t),i=!0)}),i||r(n)})}}),b.plugin(m)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.navbar.min",["kendo.core.min"],e)}(function(){return function(e,t){function n(n,i){var o=i.find("["+r.attr("align")+"="+n+"]");return o[0]?e('
').append(o).prependTo(i):t}function i(t){var n=t.siblings(),i=!!t.children("ul")[0],o=!!n[0]&&""===e.trim(t.text()),a=!(!r.mobile.application||!r.mobile.application.element.is(".km-android"));t.prevAll().toggleClass("km-absolute",i),t.toggleClass("km-show-title",o),t.toggleClass("km-fill-title",o&&!e.trim(t.html())),t.toggleClass("km-no-title",i),t.toggleClass("km-hide-title",a&&!n.children().is(":visible"))}var r=window.kendo,o=r.mobile,a=o.ui,s=a.Widget,l=s.extend({init:function(t,i){var r=this;s.fn.init.call(r,t,i),t=r.element,r.container().bind("show",e.proxy(this,"refresh")),t.addClass("km-navbar").wrapInner(e('
')),r.leftElement=n("left",t),r.rightElement=n("right",t),r.centerElement=t.find(".km-view-title")},options:{name:"NavBar"},title:function(e){this.element.find(r.roleSelector("view-title")).text(e),i(this.centerElement)},refresh:function(e){var t=e.view;this.title(t.options.title)},destroy:function(){s.fn.destroy.call(this),r.destroy(this.element)}});a.plugin(l)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.scrollview.min",["kendo.fx.min","kendo.data.min","kendo.draganddrop.min"],e)}(function(){return function(e,t){var n,i,r,o,a,s,l,c,d=window.kendo,u=d.mobile,h=u.ui,f=e.proxy,p=d.effects.Transition,m=d.ui.Pane,g=d.ui.PaneDimensions,v=h.DataBoundWidget,_=d.data.DataSource,b=d.data.Buffer,w=d.data.BatchBuffer,y=Math,k=y.abs,x=y.ceil,C=y.round,S=y.max,T=y.min,D=y.floor,A="change",E="changing",F="refresh",I="km-current-page",M="km-virtual-page",R="function",P="itemChange",z="cleanup",B=3,L=-1,H=0,N=1,O=-1,V=0,U=1,W=d.Class.extend({init:function(t){var n=this,i=e(" ");t.element.append(i),this._changeProxy=f(n,"_change"),this._refreshProxy=f(n,"_refresh"),t.bind(A,this._changeProxy),t.bind(F,this._refreshProxy),e.extend(n,{element:i,scrollView:t})},items:function(){return this.element.children()},_refresh:function(e){var t,n="";for(t=0;e.pageCount>t;t++)n+=" ";this.element.html(n),this.items().eq(e.page).addClass(I)},_change:function(e){this.items().removeClass(I).eq(e.page).addClass(I)},destroy:function(){this.scrollView.unbind(A,this._changeProxy),this.scrollView.unbind(F,this._refreshProxy),this.element.remove()}});d.mobile.ui.ScrollViewPager=W,n="transitionEnd",i="dragStart",r="dragEnd",o=d.Observable.extend({init:function(t,o){var a,s,l,c,u,h,f=this;d.Observable.fn.init.call(this),this.element=t,this.container=t.parent(),a=new d.ui.Movable(f.element),s=new p({axis:"x",movable:a,onEnd:function(){f.trigger(n)}}),l=new d.UserEvents(t,{fastTap:!0,start:function(e){2*k(e.x.velocity)>=k(e.y.velocity)?l.capture():l.cancel(),f.trigger(i,e),s.cancel()},allowSelection:!0,end:function(e){f.trigger(r,e)}}),c=new g({element:f.element,container:f.container}),u=c.x,u.bind(A,function(){f.trigger(A)}),h=new m({dimensions:c,userEvents:l,movable:a,elastic:!0}),e.extend(f,{duration:o&&o.duration||1,movable:a,transition:s,userEvents:l,dimensions:c,dimension:u,pane:h}),this.bind([n,i,r,A],o)},size:function(){return{width:this.dimensions.x.getSize(),height:this.dimensions.y.getSize()}},total:function(){return this.dimension.getTotal()},offset:function(){return-this.movable.x},updateDimension:function(){this.dimension.update(!0)},refresh:function(){this.dimensions.refresh()},moveTo:function(e){this.movable.moveAxis("x",-e)},transitionTo:function(e,t,n){n?this.moveTo(-e):this.transition.moveTo({location:e,duration:this.duration,ease:t})}}),d.mobile.ui.ScrollViewElasticPane=o,a=d.Observable.extend({init:function(e,t,n){var i=this;d.Observable.fn.init.call(this),i.element=e,i.pane=t,i._getPages(),this.page=0,this.pageSize=n.pageSize||1,this.contentHeight=n.contentHeight,this.enablePager=n.enablePager,this.pagerOverlay=n.pagerOverlay},scrollTo:function(e,t){this.page=e,this.pane.transitionTo(-e*this.pane.size().width,p.easeOutExpo,t)},paneMoved:function(e,t,n,i){var r,o,a=this,s=a.pane,l=s.size().width*a.pageSize,c=C,d=t?p.easeOutBack:p.easeOutExpo;e===O?c=x:e===U&&(c=D),o=c(s.offset()/l),r=S(a.minSnap,T(-o*l,a.maxSnap)),o!=a.page&&n&&n({currentPage:a.page,nextPage:o})&&(r=-a.page*s.size().width),s.transitionTo(r,d,i)},updatePage:function(){var e=this.pane,t=C(e.offset()/e.size().width);return t!=this.page?(this.page=t,!0):!1},forcePageUpdate:function(){return this.updatePage()},resizeTo:function(e){var t,n,i=this.pane,r=e.width;this.pageElements.width(r),"100%"===this.contentHeight&&(t=this.element.parent().height(),this.enablePager===!0&&(n=this.element.parent().find("ol.km-pages"),!this.pagerOverlay&&n.length&&(t-=n.outerHeight(!0))),this.element.css("height",t),this.pageElements.css("height",t)),i.updateDimension(),this._paged||(this.page=D(i.offset()/r)),this.scrollTo(this.page,!0),this.pageCount=x(i.total()/r),this.minSnap=-(this.pageCount-1)*r,this.maxSnap=0},_getPages:function(){this.pageElements=this.element.find(d.roleSelector("page")),this._paged=this.pageElements.length>0}}),d.mobile.ui.ScrollViewContent=a,s=d.Observable.extend({init:function(e,t,n){var i=this;d.Observable.fn.init.call(this),i.element=e,i.pane=t,i.options=n,i._templates(),i.page=n.page||0,i.pages=[],i._initPages(),i.resizeTo(i.pane.size()),i.pane.dimension.forceEnabled()},setDataSource:function(e){this.dataSource=_.create(e),this._buffer(),this._pendingPageRefresh=!1,this._pendingWidgetRefresh=!1},_viewShow:function(){var e=this;e._pendingWidgetRefresh&&(setTimeout(function(){e._resetPages()},0),e._pendingWidgetRefresh=!1)},_buffer:function(){var e=this.options.itemsPerPage;this.buffer&&this.buffer.destroy(),this.buffer=e>1?new w(this.dataSource,e):new b(this.dataSource,3*e),this._resizeProxy=f(this,"_onResize"),this._resetProxy=f(this,"_onReset"),this._endReachedProxy=f(this,"_onEndReached"),this.buffer.bind({resize:this._resizeProxy,reset:this._resetProxy,endreached:this._endReachedProxy})},_templates:function(){var e=this.options.template,t=this.options.emptyTemplate,n={},i={};typeof e===R&&(n.template=e,e="#=this.template(data)#"),this.template=f(d.template(e),n),typeof t===R&&(i.emptyTemplate=t,t="#=this.emptyTemplate(data)#"),this.emptyTemplate=f(d.template(t),i)},_initPages:function(){var e,t,n=this.pages,i=this.element;for(t=0;B>t;t++)e=new l(i),n.push(e);this.pane.updateDimension()},resizeTo:function(e){var t,n,i,r=this.pages,o=this.pane;for(t=0;r.length>t;t++)r[t].setWidth(e.width);"auto"===this.options.contentHeight?this.element.css("height",this.pages[1].element.height()):"100%"===this.options.contentHeight&&(n=this.element.parent().height(),this.options.enablePager===!0&&(i=this.element.parent().find("ol.km-pages"),!this.options.pagerOverlay&&i.length&&(n-=i.outerHeight(!0))),this.element.css("height",n),r[0].element.css("height",n),r[1].element.css("height",n),r[2].element.css("height",n)),o.updateDimension(),this._repositionPages(),this.width=e.width},scrollTo:function(e){var t,n=this.buffer;n.syncDataSource(),t=n.at(e),t&&(this._updatePagesContent(e),this.page=e)},paneMoved:function(e,t,n,i){var r,o=this,a=o.pane,s=a.size().width,l=a.offset(),c=Math.abs(l)>=s/3,u=t?d.effects.Transition.easeOutBack:d.effects.Transition.easeOutExpo,h=o.page+2>o.buffer.total(),f=0;e===U?0!==o.page&&(f=-1):e!==O||h?l>0&&c&&!h?f=1:0>l&&c&&0!==o.page&&(f=-1):f=1,r=o.page,f&&(r=f>0?r+1:r-1),n&&n({currentPage:o.page,nextPage:r})&&(f=0),0===f?o._cancelMove(u,i):-1===f?o._moveBackward(i):1===f&&o._moveForward(i)},updatePage:function(){var e=this.pages;return 0===this.pane.offset()?!1:(this.pane.offset()>0?(e.push(this.pages.shift()),this.page++,this.setPageContent(e[2],this.page+1)):(e.unshift(this.pages.pop()),this.page--,this.setPageContent(e[0],this.page-1)),this._repositionPages(),this._resetMovable(),!0)},forcePageUpdate:function(){var e=this.pane.offset(),t=3*this.pane.size().width/4;return k(e)>t?this.updatePage():!1},_resetMovable:function(){this.pane.moveTo(0)},_moveForward:function(e){this.pane.transitionTo(-this.width,d.effects.Transition.easeOutExpo,e)},_moveBackward:function(e){this.pane.transitionTo(this.width,d.effects.Transition.easeOutExpo,e)},_cancelMove:function(e,t){this.pane.transitionTo(0,e,t)},_resetPages:function(){this.page=this.options.page||0,this._updatePagesContent(this.page),this._repositionPages(),this.trigger("reset")},_onResize:function(){this.pageCount=x(this.dataSource.total()/this.options.itemsPerPage),this._pendingPageRefresh&&(this._updatePagesContent(this.page),this._pendingPageRefresh=!1),this.trigger("resize")},_onReset:function(){this.pageCount=x(this.dataSource.total()/this.options.itemsPerPage),this._resetPages()},_onEndReached:function(){this._pendingPageRefresh=!0},_repositionPages:function(){var e=this.pages;e[0].position(L),e[1].position(H),e[2].position(N)},_updatePagesContent:function(e){var t=this.pages,n=e||0;this.setPageContent(t[0],n-1),this.setPageContent(t[1],n),this.setPageContent(t[2],n+1)},setPageContent:function(t,n){var i=this.buffer,r=this.template,o=this.emptyTemplate,a=null;n>=0&&(a=i.at(n),e.isArray(a)&&!a.length&&(a=null)),this.trigger(z,{item:t.element}),t.content(null!==a?r(a):o({})),d.mobile.init(t.element),this.trigger(P,{item:t.element,data:a,ns:d.mobile.ui})}}),d.mobile.ui.VirtualScrollViewContent=s,l=d.Class.extend({init:function(t){this.element=e("
"),this.width=t.width(),this.element.width(this.width),t.append(this.element)},content:function(e){this.element.html(e)},position:function(e){this.element.css("transform","translate3d("+this.width*e+"px, 0, 0)")},setWidth:function(e){this.width=e,this.element.width(e)}}),d.mobile.ui.VirtualPage=l,c=v.extend({init:function(e,t){var n,i,r,l=this;v.fn.init.call(l,e,t),t=l.options,e=l.element,d.stripWhitespace(e[0]),e.wrapInner("
").addClass("km-scrollview"),this.options.enablePager&&(this.pager=new W(this),this.options.pagerOverlay&&e.addClass("km-scrollview-overlay")),l.inner=e.children().first(),l.page=0,l.inner.css("height",t.contentHeight),l.pane=new o(l.inner,{duration:this.options.duration,transitionEnd:f(this,"_transitionEnd"),dragStart:f(this,"_dragStart"),dragEnd:f(this,"_dragEnd"),change:f(this,F)}),l.bind("resize",function(){l.pane.refresh()}),l.page=t.page,n=0===this.inner.children().length,i=n?new s(l.inner,l.pane,t):new a(l.inner,l.pane,t),i.page=l.page,i.bind("reset",function(){this._pendingPageRefresh=!1,l._syncWithContent(),l.trigger(F,{pageCount:i.pageCount,page:i.page})}),i.bind("resize",function(){l.trigger(F,{pageCount:i.pageCount,page:i.page})}),i.bind(P,function(e){l.trigger(P,e),l.angular("compile",function(){return{elements:e.item,data:[{dataItem:e.data}]}})}),i.bind(z,function(e){l.angular("cleanup",function(){return{elements:e.item}})}),l._content=i,l.setDataSource(t.dataSource),r=l.container(),r.nullObject?(l.viewInit(),l.viewShow()):r.bind("show",f(this,"viewShow")).bind("init",f(this,"viewInit"))},options:{name:"ScrollView",page:0,duration:400,velocityThreshold:.8,contentHeight:"auto",pageSize:1,itemsPerPage:1,bounceVelocityThreshold:1.6,enablePager:!0,pagerOverlay:!1,autoBind:!0,template:"",emptyTemplate:""},events:[E,A,F],destroy:function(){v.fn.destroy.call(this),d.destroy(this.element)},viewInit:function(){this.options.autoBind&&this._content.scrollTo(this._content.page,!0)},viewShow:function(){this.pane.refresh()},refresh:function(){var e=this._content;e.resizeTo(this.pane.size()),this.page=e.page,this.trigger(F,{pageCount:e.pageCount,page:e.page})},content:function(e){this.element.children().first().html(e),this._content._getPages(),this.pane.refresh()},value:function(e){var n=this.dataSource;return e?(this.scrollTo(n.indexOf(e),!0),t):n.at(this.page)},scrollTo:function(e,t){this._content.scrollTo(e,t),this._syncWithContent()},prev:function(){var e=this,n=e.page-1;e._content instanceof s?e._content.paneMoved(U,t,function(t){return e.trigger(E,t)}):n>-1&&e.scrollTo(n)},next:function(){var e=this,n=e.page+1;e._content instanceof s?e._content.paneMoved(O,t,function(t){return e.trigger(E,t)}):e._content.pageCount>n&&e.scrollTo(n)},setDataSource:function(e){if(this._content instanceof s){var t=!e;this.dataSource=_.create(e),this._content.setDataSource(this.dataSource),this.options.autoBind&&!t&&this.dataSource.fetch()}},items:function(){return this.element.find("."+M)},_syncWithContent:function(){var e,n,i=this._content.pages,r=this._content.buffer;this.page=this._content.page,e=r?r.at(this.page):t,e instanceof Array||(e=[e]),n=i?i[1].element:t,this.trigger(A,{page:this.page,element:n,data:e})},_dragStart:function(){this._content.forcePageUpdate()&&this._syncWithContent()},_dragEnd:function(e){var t=this,n=e.x.velocity,i=this.options.velocityThreshold,r=V,o=k(n)>this.options.bounceVelocityThreshold;n>i?r=U:-i>n&&(r=O),this._content.paneMoved(r,o,function(e){return t.trigger(E,e)})},_transitionEnd:function(){this._content.updatePage()&&this._syncWithContent()}}),h.plugin(c)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.switch.min",["kendo.fx.min","kendo.userevents.min"],e)}(function(){return function(e,t){function n(e,t,n){return Math.max(t,Math.min(n,e))}var i=window.kendo,r=i.mobile.ui,o=r.Widget,a=i.support,s="change",l="km-switch-on",c="km-switch-off",d="margin-left",u="km-state-active",h="km-state-disabled",f="disabled",p=a.transitions.css+"transform",m=e.proxy,g=' {0} {1} ',v=o.extend({init:function(t,n){var r,a=this;o.fn.init.call(a,t,n),n=a.options,a.wrapper=e(i.format(g,n.onLabel,n.offLabel)),a.handle=a.wrapper.find(".km-switch-handle"),a.background=a.wrapper.find(".km-switch-background"),a.wrapper.insertBefore(a.element).prepend(a.element),a._drag(),a.origin=parseInt(a.background.css(d),10),a.constrain=0,a.snapPoint=0,t=a.element[0],t.type="checkbox",a._animateBackground=!0,r=a.options.checked,null===r&&(r=t.checked),a.check(r),a.options.enable=a.options.enable&&!a.element.attr(f),a.enable(a.options.enable),a.refresh(),i.notify(a,i.mobile.ui)},refresh:function(){var e=this,t=e.handle.outerWidth(!0);e.width=e.wrapper.width(),e.constrain=e.width-t,e.snapPoint=e.constrain/2,"number"!=typeof e.origin&&(e.origin=parseInt(e.background.css(d),10)),e.background.data("origin",e.origin),e.check(e.element[0].checked)},events:[s],options:{name:"Switch",onLabel:"on",offLabel:"off",checked:null,enable:!0},check:function(e){var n=this,i=n.element[0];return e===t?i.checked:(n._position(e?n.constrain:0),i.checked=e,n.wrapper.toggleClass(l,e).toggleClass(c,!e),t)},value:function(){return this.check.apply(this,arguments)},destroy:function(){o.fn.destroy.call(this),this.userEvents.destroy()},toggle:function(){var e=this;e.check(!e.element[0].checked)},enable:function(e){var n=this.element,i=this.wrapper;t===e&&(e=!0),this.options.enable=e,e?n.removeAttr(f):n.attr(f,f),i.toggleClass(h,!e)},_resize:function(){this.refresh()},_move:function(e){var t=this;e.preventDefault(),t._position(n(t.position+e.x.delta,0,t.width-t.handle.outerWidth(!0)))},_position:function(e){var t=this;t.position=e,t.handle.css(p,"translatex("+e+"px)"),t._animateBackground&&t.background.css(d,t.origin+e)},_start:function(){this.options.enable?(this.userEvents.capture(),this.handle.addClass(u)):this.userEvents.cancel()},_stop:function(){var e=this;e.handle.removeClass(u),e._toggle(e.position>e.snapPoint)},_toggle:function(e){var t,n=this,r=n.handle,o=n.element[0],a=o.checked,d=i.mobile.application&&i.mobile.application.os.wp?100:200;n.wrapper.toggleClass(l,e).toggleClass(c,!e),n.position=t=e*n.constrain,n._animateBackground&&n.background.kendoStop(!0,!0).kendoAnimate({effects:"slideMargin",offset:t,reset:!0,reverse:!e,axis:"left",duration:d}),r.kendoStop(!0,!0).kendoAnimate({effects:"slideTo",duration:d,offset:t+"px,0",reset:!0,complete:function(){a!==e&&(o.checked=e,n.trigger(s,{checked:e}))}})},_drag:function(){var e=this;e.userEvents=new i.UserEvents(e.wrapper,{fastTap:!0,tap:function(){e.options.enable&&e._toggle(!e.element[0].checked)},start:m(e._start,e),move:m(e._move,e),end:m(e._stop,e)})}});r.plugin(v)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.tabstrip.min",["kendo.core.min"],e)}(function(){return function(e,t){function n(t){return e(''+t+" ")}var i=window.kendo,r=i.mobile.ui,o=r.Widget,a="km-state-active",s="select",l=o.extend({init:function(t,n){var i=this;o.fn.init.call(i,t,n),i.container().bind("show",e.proxy(this,"refresh")),i.element.addClass("km-tabstrip").find("a").each(i._buildButton).eq(i.options.selectedIndex).addClass(a),i.element.on("down","a","_release")},events:[s],switchTo:function(t){var n,i,r=this.element.find("a"),o=0,a=r.length;if(!isNaN(t))return this._setActiveItem(r.eq(t)),!0;for(;a>o;o++)if(n=r[o],i=n.href.replace(/(\#.+)(\?.+)$/,"$1"),-1!==i.indexOf(t,i.length-t.length))return this._setActiveItem(e(n)),!0;return!1},switchByFullUrl:function(e){var t;t=this.element.find("a[href$='"+e+"']"),this._setActiveItem(t)},clear:function(){this.currentItem().removeClass(a)},currentItem:function(){return this.element.children("."+a)},badge:function(t,i){var r,o=this.element;return isNaN(t)||(t=o.children().get(t)),t=o.find(t),r=e(t.find(".km-badge")[0]||n(i).insertAfter(t.children(".km-icon"))),i||0===i?(r.html(i),this):i===!1?(r.empty().remove(),this):r.html()},_release:function(t){if(!(t.which>1)){var n=this,i=e(t.currentTarget);i[0]!==n.currentItem()[0]&&(n.trigger(s,{item:i})?t.preventDefault():n._setActiveItem(i))}},_setActiveItem:function(e){e[0]&&(this.clear(),e.addClass(a))},_buildButton:function(){var t=e(this),r=i.attrValue(t,"icon"),o=i.attrValue(t,"badge"),a=t.find("img"),s=e(' ');t.addClass("km-button").attr(i.attr("role"),"tab").contents().not(a).wrapAll(' '),a[0]?a.addClass("km-image").prependTo(t):(t.prepend(s),r&&(s.addClass("km-"+r),(o||0===o)&&n(o).insertAfter(s)))},refresh:function(e){var t=e.view.id;t&&!this.switchTo(e.view.id)&&this.switchTo(t)},options:{name:"TabStrip",selectedIndex:0,enable:!0}});r.plugin(l)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.mobile.min",["kendo.core.min","kendo.fx.min","kendo.data.odata.min","kendo.data.xml.min","kendo.data.min","kendo.data.signalr.min","kendo.binder.min","kendo.validator.min","kendo.router.min","kendo.view.min","kendo.userevents.min","kendo.draganddrop.min","kendo.popup.min","kendo.touch.min","kendo.mobile.popover.min","kendo.mobile.loader.min","kendo.mobile.scroller.min","kendo.mobile.shim.min","kendo.mobile.view.min","kendo.mobile.modalview.min","kendo.mobile.drawer.min","kendo.mobile.splitview.min","kendo.mobile.pane.min","kendo.mobile.application.min","kendo.mobile.actionsheet.min","kendo.mobile.button.min","kendo.mobile.buttongroup.min","kendo.mobile.collapsible.min","kendo.mobile.listview.min","kendo.mobile.navbar.min","kendo.mobile.scrollview.min","kendo.mobile.switch.min","kendo.mobile.tabstrip.min","kendo.angular.min","kendo.webcomponents.min","kendo.angular2.min"],e)}(function(){"bundle all";return window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()}),function(e,define){define("kendo.all.min",["kendo.web.min","kendo.dataviz.min","kendo.mobile.min","kendo.drawing.min","kendo.dom.min"],e)}(function(){"bundle all";return window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()});
//# sourceMappingURL=kendo.all.min.js.map